Re: task_numa_fault() && TASK_DEAD

From: Oleg Nesterov
Date: Fri Sep 05 2014 - 07:38:56 EST


On 09/04, Hugh Dickins wrote:
>
> On Thu, 4 Sep 2014, Oleg Nesterov wrote:
> > On 09/04, Peter Zijlstra wrote:
> > > On Wed, Sep 03, 2014 at 06:08:19PM +0200, Oleg Nesterov wrote:
> > >
> > > > And a stupid (really, I don't understand this code) question:
> > > >
> > > > /* for example, ksmd faulting in a user's mm */
> > > > if (!p->mm)
> > > > return;
>
> I don't understand your difficulty with that, I thought the comment
> was helpful enough.

Yes, yes, sorry for confusion, the comment and the check itself look clear.

> Does the original commit comment help?
>
> commit 2832bc19f6668fd00116f61f821105040599ef8b
> Author: Hugh Dickins <hughd@xxxxxxxxxx>
> Date: Wed Dec 19 17:42:16 2012 -0800
>
> sched: numa: ksm: fix oops in task_numa_placment()
>
> task_numa_placement() oopsed on NULL p->mm

Yes. But I thought that even if task_numa_placment() didn't OOPS in case
when ->mm = NULL, it would be better to exclude ksmd. And other kthreads
which can have ->mm != NULL, and PTRACE_POKE or sys_process_vm_writev()
users:

/* do nothing if this task accesses a foreign mm */
if (p->mm != mm || (p->flags & PF_KTHREAD)
return;

Please forget. This is minor, and my main question was the wrong usage
of TASK_DEAD.

Oleg.

--
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/