Re: [PATCH 07/12] x86/virt/guest/xen: Remove use of pgd_list from the Xen guest code

From: Ingo Molnar
Date: Sat Jun 13 2015 - 03:27:02 EST



* Oleg Nesterov <oleg@xxxxxxxxxx> wrote:

> > So we could add tsk->mm_leader or so,
>
> No, no, please do not. Just do something like
>
> for_each_process(p) {
>
> for_each_thread(p, t) {

So far that's what the for_each_process_thread() iterations I added do, right?

> if (t->mm) {
> do_something(t->mm);
> break;
> }
> }
> }
>
> But either way I don't understand what protects this ->mm. Perhaps this needs
> find_lock_task_mm().

That's indeed a bug: I'll add task_lock()/unlock() before looking at ->mm.

find_lock_task_mm() is not needed IMHO: we have a stable reference to 't', as a
task can only go away via RCU expiry, and all the iterations I added are (supposed
to) be RCU safe.

Thanks,

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/