fix: memory leak due to forced termination during startup
Change-Id: Ide519f01702bfd17ae4576e04806b6d155ae846a refs: #1397
This commit is contained in:
committed by
Masamichi Takagi
parent
93581cb142
commit
9e2196c9ce
@@ -598,7 +598,6 @@ static void syscall_channel_send(struct ihk_ikc_channel_desc *c,
|
||||
}
|
||||
|
||||
extern unsigned long do_kill(struct thread *, int, int, int, struct siginfo *, int ptracecont);
|
||||
extern void terminate_host(int pid);
|
||||
extern void debug_log(long);
|
||||
|
||||
void send_procfs_answer(struct ikc_scd_packet *packet, int err)
|
||||
@@ -764,8 +763,9 @@ out_remote_pf:
|
||||
break;
|
||||
|
||||
case SCD_MSG_CLEANUP_PROCESS:
|
||||
dkprintf("SCD_MSG_CLEANUP_PROCESS pid=%d\n", packet->pid);
|
||||
terminate_host(packet->pid);
|
||||
dkprintf("SCD_MSG_CLEANUP_PROCESS pid=%d, thread=0x%llx\n",
|
||||
packet->pid, packet->arg);
|
||||
terminate_host(packet->pid, (struct thread *)packet->arg);
|
||||
ret = 0;
|
||||
break;
|
||||
|
||||
|
||||
@@ -634,4 +634,5 @@ extern int (*linux_clock_gettime)(clockid_t clk_id, struct timespec *tp);
|
||||
#define COREDUMP_DESCHEDULED 1
|
||||
#define COREDUMP_TO_BE_WOKEN 2
|
||||
|
||||
extern void terminate_host(int pid, struct thread *thread);
|
||||
#endif
|
||||
|
||||
@@ -73,7 +73,6 @@ static struct vm_range *vm_range_find(struct process_vm *vm,
|
||||
unsigned long addr);
|
||||
static int copy_user_ranges(struct process_vm *vm, struct process_vm *orgvm);
|
||||
extern void __runq_add_proc(struct thread *proc, int cpu_id);
|
||||
extern void terminate_host(int pid);
|
||||
extern void lapic_timer_enable(unsigned int clocks);
|
||||
extern void lapic_timer_disable();
|
||||
extern int num_processors;
|
||||
@@ -288,6 +287,8 @@ struct thread *create_thread(unsigned long user_pc,
|
||||
return NULL;
|
||||
memset(thread, 0, sizeof(struct thread));
|
||||
ihk_atomic_set(&thread->refcount, 2);
|
||||
INIT_LIST_HEAD(&thread->hash_list);
|
||||
INIT_LIST_HEAD(&thread->siblings_list);
|
||||
proc = kmalloc(sizeof(struct process), IHK_MC_AP_NOWAIT);
|
||||
vm = kmalloc(sizeof(struct process_vm), IHK_MC_AP_NOWAIT);
|
||||
asp = create_address_space(cpu_local_var(resource_set), 1);
|
||||
|
||||
@@ -1407,14 +1407,21 @@ void terminate(int rc, int sig)
|
||||
}
|
||||
|
||||
void
|
||||
terminate_host(int pid)
|
||||
terminate_host(int pid, struct thread *thread)
|
||||
{
|
||||
struct process *proc;
|
||||
struct mcs_rwlock_node_irqsave lock;
|
||||
|
||||
proc = find_process(pid, &lock);
|
||||
if(!proc)
|
||||
if (!proc) {
|
||||
if (thread) {
|
||||
proc = thread->proc;
|
||||
ihk_atomic_set(&thread->refcount, 1);
|
||||
release_thread(thread);
|
||||
release_process(proc);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (proc->nohost != 1) {
|
||||
proc->nohost = 1;
|
||||
|
||||
Reference in New Issue
Block a user