Skip to content

Commit 32b874e

Browse files
committed
use MAX_MCACHE_ORDER instead of hard-coded
1 parent 7632b7c commit 32b874e

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

kernel-open/nvidia-uvm/uvm_kvmalloc.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,6 @@ static void *alloc_internal(size_t size, bool zero_memory)
257257
// Make sure that (sizeof(hdr) + size) is what it should be
258258
BUILD_BUG_ON(sizeof(uvm_vmalloc_hdr_t) != offsetof(uvm_vmalloc_hdr_t *, ptr));
259259

260-
assert(size <= (1 << 32));
261260
if (size <= UVM_KMALLOC_THRESHOLD) {
262261
if (zero_memory)
263262
return kzalloc(size, NV_UVM_GFP_FLAGS);

kernel-open/nvidia-uvm/uvm_kvmalloc.h

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@
2727
#include "uvm_nanos.h"
2828
#include "uvm_test_ioctl.h"
2929

30+
#ifndef _CONFIG_H_
31+
#include <config.h>
32+
#define _CONFIG_H_
33+
#endif
34+
3035
// kmalloc is faster than vmalloc because it doesn't have to remap kernel
3136
// virtual memory, but for that same reason it requires physically-contiguous
3237
// memory. It also supports a native krealloc function which is missing in
@@ -41,9 +46,7 @@
4146
//
4247
// This is in the header so callers can use it to inform their allocation sizes
4348
// if they wish.
44-
//
45-
// Default value is 16. See: https://github.com/nanovms/nanos/blob/103518003874e7c8c3cb6e5a93d81fd0f197fde6/src/config.h#L84-L85
46-
#define UVM_KMALLOC_THRESHOLD 16
49+
#define UVM_KMALLOC_THRESHOLD (1 << MAX_MCACHE_ORDER)
4750

4851
NV_STATUS uvm_kvmalloc_init(void);
4952
void uvm_kvmalloc_exit(void);

0 commit comments

Comments
 (0)