[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20131203190129.GA18159@redhat.com>
Date: Tue, 3 Dec 2013 20:01:29 +0100
From: Oleg Nesterov <oleg@...hat.com>
To: Sergey Dyasly <dserrg@...il.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
David Rientjes <rientjes@...gle.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Mandeep Singh Baines <msb@...omium.org>,
"Ma, Xindong" <xindong.ma@...el.com>,
Michal Hocko <mhocko@...e.cz>,
Sameer Nanda <snanda@...omium.org>,
"Tu, Xiaobing" <xiaobing.tu@...el.com>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 0/2] initial while_each_thread() fixes
argh, sorry, I didn't finish my email...
On 12/03, Sergey Dyasly wrote:
>
> On Mon, 2 Dec 2013 16:24:23 +0100
> Oleg Nesterov <oleg@...hat.com> wrote:
>
> > Recently people started to report they actually hit this problem in
> > oom_kill.c. This doesn't really matter and I can be wrong, but in
> > fact I do not think they really hit this race, it is very unlikely.
>
> The race is very easy to catch if you have a process with several threads,
> all of which allocates memory simultaneously. This leads to:
>
> 1) OOMk selects and sends SIGKILL to one of the threads
>
> 2) another thread invokes OOMk and the first thread gets selected,
> but it gets unhashed before while_each_thread...
Yes, but this is what I meant.
It was unhashed before even while_each_thread(g), and it should be
never used unless you ensure that g is still alive.
But this doesn't matter. while_each_thread() was buggy anyway. And
(perhaps even more importantly) it was not easy to use it correctly,
so I finally decided to add another helper which only needs the
stable task_struct.
> The patches look correct and my test case no longer hangs, so
>
> Reviewed-and-Tested-by: Sergey Dyasly <dserrg@...il.com>
Thanks!
Oleg.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists