Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031248AbbD1Wnj (ORCPT ); Tue, 28 Apr 2015 18:43:39 -0400 Received: from mail-ig0-f180.google.com ([209.85.213.180]:37707 "EHLO mail-ig0-f180.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1030901AbbD1Wni (ORCPT ); Tue, 28 Apr 2015 18:43:38 -0400 Date: Tue, 28 Apr 2015 15:43:35 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Johannes Weiner cc: Andrew Morton , Michal Hocko , Tetsuo Handa , Andrea Arcangeli , Dave Chinner , Vlastimil Babka , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 6/9] mm: oom_kill: simplify OOM killer locking In-Reply-To: <1430161555-6058-7-git-send-email-hannes@cmpxchg.org> Message-ID: References: <1430161555-6058-1-git-send-email-hannes@cmpxchg.org> <1430161555-6058-7-git-send-email-hannes@cmpxchg.org> User-Agent: Alpine 2.10 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2014 Lines: 42 On Mon, 27 Apr 2015, Johannes Weiner wrote: > The zonelist locking and the oom_sem are two overlapping locks that > are used to serialize global OOM killing against different things. > > The historical zonelist locking serializes OOM kills from allocations > with overlapping zonelists against each other to prevent killing more > tasks than necessary in the same memory domain. Only when neither > tasklists nor zonelists from two concurrent OOM kills overlap (tasks > in separate memcgs bound to separate nodes) are OOM kills allowed to > execute in parallel. > > The younger oom_sem is a read-write lock to serialize OOM killing > against the PM code trying to disable the OOM killer altogether. > > However, the OOM killer is a fairly cold error path, there is really > no reason to optimize for highly performant and concurrent OOM kills. > And the oom_sem is just flat-out redundant. > > Replace both locking schemes with a single global mutex serializing > OOM kills regardless of context. > > Signed-off-by: Johannes Weiner > Acked-by: Michal Hocko Acked-by: David Rientjes Thanks for doing this, it cleans up the code quite a bit and I think there's the added benefit of not interleaving oom killer messages in the kernel log, and that's important since it's the only way we can currently discover that the kernel has killed something. It's not vital and somewhat unrelated to your patch, but if we can't grab the mutex with the trylock in __alloc_pages_may_oom() then I think it would be more correct to do schedule_timeout_killable() rather than uninterruptible. I just mention it if you happen to go through another revision of the series and want to switch it at the same time. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/