@@ -97,6 +97,8 @@ struct cpu_local_var {
|
|||||||
|
|
||||||
ihk_spinlock_t smp_func_req_lock;
|
ihk_spinlock_t smp_func_req_lock;
|
||||||
struct list_head smp_func_req_list;
|
struct list_head smp_func_req_list;
|
||||||
|
|
||||||
|
struct process_vm *on_fork_vm;
|
||||||
} __attribute__((aligned(64)));
|
} __attribute__((aligned(64)));
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ rusage_rss_add(unsigned long size)
|
|||||||
unsigned long newval;
|
unsigned long newval;
|
||||||
unsigned long oldval;
|
unsigned long oldval;
|
||||||
unsigned long retval;
|
unsigned long retval;
|
||||||
struct process_vm *vm = cpu_local_var(current)->vm;
|
struct process_vm *vm;
|
||||||
|
|
||||||
newval = __sync_add_and_fetch(&rusage->rss_current, size);
|
newval = __sync_add_and_fetch(&rusage->rss_current, size);
|
||||||
oldval = rusage->memory_max_usage;
|
oldval = rusage->memory_max_usage;
|
||||||
@@ -49,6 +49,11 @@ rusage_rss_add(unsigned long size)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* process rss */
|
/* process rss */
|
||||||
|
vm = cpu_local_var(on_fork_vm);
|
||||||
|
if (!vm) {
|
||||||
|
vm = cpu_local_var(current)->vm;
|
||||||
|
}
|
||||||
|
|
||||||
vm->currss += size;
|
vm->currss += size;
|
||||||
if (vm->currss > vm->proc->maxrss) {
|
if (vm->currss > vm->proc->maxrss) {
|
||||||
vm->proc->maxrss = vm->currss;
|
vm->proc->maxrss = vm->currss;
|
||||||
|
|||||||
@@ -398,6 +398,7 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp,
|
|||||||
int termsig = clone_flags & 0xff;
|
int termsig = clone_flags & 0xff;
|
||||||
struct process *proc = NULL;
|
struct process *proc = NULL;
|
||||||
struct address_space *asp = NULL;
|
struct address_space *asp = NULL;
|
||||||
|
struct cpu_local_var *v = get_this_cpu_local_var();
|
||||||
|
|
||||||
if ((thread = ihk_mc_alloc_pages(KERNEL_STACK_NR_PAGES,
|
if ((thread = ihk_mc_alloc_pages(KERNEL_STACK_NR_PAGES,
|
||||||
IHK_MC_AP_NOWAIT)) == NULL) {
|
IHK_MC_AP_NOWAIT)) == NULL) {
|
||||||
@@ -484,12 +485,15 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp,
|
|||||||
dkprintf("fork(): copy_user_ranges()\n");
|
dkprintf("fork(): copy_user_ranges()\n");
|
||||||
/* Copy user-space mappings.
|
/* Copy user-space mappings.
|
||||||
* TODO: do this with COW later? */
|
* TODO: do this with COW later? */
|
||||||
|
v->on_fork_vm = proc->vm;
|
||||||
if (copy_user_ranges(proc->vm, org->vm) != 0) {
|
if (copy_user_ranges(proc->vm, org->vm) != 0) {
|
||||||
release_address_space(asp);
|
release_address_space(asp);
|
||||||
|
v->on_fork_vm = NULL;
|
||||||
kfree(proc->vm);
|
kfree(proc->vm);
|
||||||
kfree(proc);
|
kfree(proc);
|
||||||
goto err_free_proc;
|
goto err_free_proc;
|
||||||
}
|
}
|
||||||
|
v->on_fork_vm = NULL;
|
||||||
|
|
||||||
/* Copy mckfd list
|
/* Copy mckfd list
|
||||||
FIXME: Replace list manipulation with list_add() etc. */
|
FIXME: Replace list manipulation with list_add() etc. */
|
||||||
@@ -522,8 +526,6 @@ clone_thread(struct thread *org, unsigned long pc, unsigned long sp,
|
|||||||
|
|
||||||
thread->vm->vdso_addr = org->vm->vdso_addr;
|
thread->vm->vdso_addr = org->vm->vdso_addr;
|
||||||
thread->vm->vvar_addr = org->vm->vvar_addr;
|
thread->vm->vvar_addr = org->vm->vvar_addr;
|
||||||
thread->proc->maxrss = org->proc->maxrss;
|
|
||||||
thread->vm->currss = org->vm->currss;
|
|
||||||
|
|
||||||
thread->sigstack.ss_sp = org->sigstack.ss_sp;
|
thread->sigstack.ss_sp = org->sigstack.ss_sp;
|
||||||
thread->sigstack.ss_flags = org->sigstack.ss_flags;
|
thread->sigstack.ss_flags = org->sigstack.ss_flags;
|
||||||
|
|||||||
Reference in New Issue
Block a user