[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20150326110532.GB18560@cmpxchg.org>
Date: Thu, 26 Mar 2015 07:05:32 -0400
From: Johannes Weiner <hannes@...xchg.org>
To: David Rientjes <rientjes@...gle.com>
Cc: linux-mm@...ck.org, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Huang Ying <ying.huang@...el.com>,
Andrea Arcangeli <aarcange@...hat.com>,
Dave Chinner <david@...morbit.com>,
Michal Hocko <mhocko@...e.cz>, Theodore Ts'o <tytso@....edu>
Subject: Re: [patch 03/12] mm: oom_kill: switch test-and-clear of known
TIF_MEMDIE to clear
Hi David,
On Wed, Mar 25, 2015 at 08:31:49PM -0700, David Rientjes wrote:
> On Wed, 25 Mar 2015, Johannes Weiner wrote:
>
> > exit_oom_victim() already knows that TIF_MEMDIE is set, and nobody
> > else can clear it concurrently. Use clear_thread_flag() directly.
> >
> > Signed-off-by: Johannes Weiner <hannes@...xchg.org>
>
> For the oom killer, that's true because of task_lock(): we always only set
> TIF_MEMDIE when there is a valid p->mm and it's cleared in the exit path
> after the unlock, acting as a barrier, when p->mm is set to NULL so it's
> no longer a valid victim. So that part is fine.
>
> The problem is the android low memory killer that does
> mark_tsk_oom_victim() without the protection of task_lock(), it's just rcu
> protected so the reference to the task itself is guaranteed to still be
> valid.
But this is about *setting* it without a lock. My point was that once
TIF_MEMDIE is actually set, the task owns it and nobody else can clear
it for them, so it's safe to test and clear non-atomically from the
task's own context. Am I missing something?
--
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