From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1762207Ab3DCMfK (ORCPT ); Wed, 3 Apr 2013 08:35:10 -0400 Received: from zene.cmpxchg.org ([85.214.230.12]:42499 "EHLO zene.cmpxchg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759408Ab3DCMfJ (ORCPT ); Wed, 3 Apr 2013 08:35:09 -0400 Date: Wed, 3 Apr 2013 08:34:52 -0400 From: Johannes Weiner To: David Rientjes Cc: Andrew Morton , Michal Hocko , KAMEZAWA Hiroyuki , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [patch] mm, memcg: give exiting processes access to memory reserves Message-ID: <20130403123452.GK1953@cmpxchg.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 27, 2013 at 06:22:10PM -0700, David Rientjes wrote: > A memcg may livelock when oom if the process that grabs the hierarchy's > oom lock is never the first process with PF_EXITING set in the memcg's > task iteration. > > The oom killer, both global and memcg, will defer if it finds an eligible > process that is in the process of exiting and it is not being ptraced. > The idea is to allow it to exit without using memory reserves before > needlessly killing another process. > > This normally works fine except in the memcg case with a large number of > threads attached to the oom memcg. In this case, the memcg oom killer > only gets called for the process that grabs the hierarchy's oom lock; all > others end up blocked on the memcg's oom waitqueue. Thus, if the process > that grabs the hierarchy's oom lock is never the first PF_EXITING process > in the memcg's task iteration, the oom killer is constantly deferred > without anything making progress. > > The fix is to give PF_EXITING processes access to memory reserves so that > we've marked them as oom killed without any iteration. This allows > __mem_cgroup_try_charge() to succeed so that the process may exit. This > makes the memcg oom killer exemption for TIF_MEMDIE tasks, now > immediately granted for processes with pending SIGKILLs and those in the > exit path, to be equivalent to what is done for the global oom killer. > > Signed-off-by: David Rientjes Acked-by: Johannes Weiner