diff --git a/kernel/include/process.h b/kernel/include/process.h index 095560df..9132af03 100644 --- a/kernel/include/process.h +++ b/kernel/include/process.h @@ -168,6 +168,15 @@ #define PROCESS_NUMA_MASK_BITS 64 +enum { + MPOL_DEFAULT, + MPOL_PREFERRED, + MPOL_BIND, + MPOL_INTERLEAVE, + MPOL_LOCAL, + MPOL_MAX, /* always last member of enum */ +}; + #include #include @@ -598,6 +607,7 @@ struct process_vm { long currss; DECLARE_BITMAP(numa_mask, PROCESS_NUMA_MASK_BITS); + int numa_mem_policy; }; static inline int has_cap_ipc_lock(struct thread *th) diff --git a/kernel/process.c b/kernel/process.c index fe78dd37..858fc092 100644 --- a/kernel/process.c +++ b/kernel/process.c @@ -223,6 +223,7 @@ init_process_vm(struct process *owner, struct address_space *asp, struct process } set_bit(i, &vm->numa_mask[0]); } + vm->numa_mem_policy = MPOL_DEFAULT; return 0; } @@ -384,6 +385,8 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp, } memcpy(&proc->vm->numa_mask, &org->vm->numa_mask, sizeof(proc->vm->numa_mask)); + proc->vm->numa_mem_policy = + org->vm->numa_mem_policy; thread->proc = proc; thread->vm = proc->vm; diff --git a/kernel/syscall.c b/kernel/syscall.c index 63f843a1..fb537c4e 100644 --- a/kernel/syscall.c +++ b/kernel/syscall.c @@ -7077,16 +7077,6 @@ out: return error; } /* sys_getcpu() */ -/* XXX: move this to header.. */ -enum { - MPOL_DEFAULT, - MPOL_PREFERRED, - MPOL_BIND, - MPOL_INTERLEAVE, - MPOL_LOCAL, - MPOL_MAX, /* always last member of enum */ -}; - SYSCALL_DECLARE(mbind) { return -ENOSYS; @@ -7112,7 +7102,9 @@ SYSCALL_DECLARE(get_mempolicy) } if (mode) { - error = copy_to_user(mode, MPOL_DEFAULT, sizeof(*mode)); + error = copy_to_user(mode, + &cpu_local_var(current)->vm->numa_mem_policy, + sizeof(int)); if (error) { error = -EINVAL; goto out;