On 02/03, Anton Vorontsov wrote:
@@ -132,7 +133,7 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) } selected_oom_adj = min_adj;
- read_lock(&tasklist_lock);
- rcu_read_lock(); for_each_process(p) { struct mm_struct *mm; struct signal_struct *sig;
@@ -180,12 +181,12 @@ static int lowmem_shrink(struct shrinker *s, struct shrink_control *sc) lowmem_deathpending = selected; task_handoff_register(&task_nb); #endif
force_sig(SIGKILL, selected);
rem -= selected_tasksize; } lowmem_print(4, "lowmem_shrink %lu, %x, return %d\n", sc->nr_to_scan, sc->gfp_mask, rem);send_sig(SIGKILL, selected, 0);
- read_unlock(&tasklist_lock);
- rcu_read_unlock();
I think this is correct. As for ->mm check please look at find_lock_task_mm().
You can also remove the !sig check.
And, forgot to mention. There is another reason why mm != NULL check is wrong (send_sig_all too). A kernel thread can do use_mm(). You should also check PF_KTHREAD.
Oleg.