static void oom_kill(void) { struct task_struct *p, *q; read_lock(&tasklist_lock); p = select_bad_process(); /* Found nothing?!?! Either we hang forever, or we panic. */ if (p == NULL) panic("Out of memory and no killable processes...\n"); /* kill all processes that share the ->mm (i.e. all threads) */ for_each_task(q) { if (q->mm == p->mm) oom_kill_task(q); } read_unlock(&tasklist_lock); /* * Make kswapd go out of the way, so "p" has a good chance of * killing itself before someone else gets the chance to ask * for more memory. */ yield(); return; }