Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756440Ab0BJUx2 (ORCPT ); Wed, 10 Feb 2010 15:53:28 -0500 Received: from mx1.redhat.com ([209.132.183.28]:48011 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756121Ab0BJUx0 (ORCPT ); Wed, 10 Feb 2010 15:53:26 -0500 Message-ID: <4B731CA6.3030304@redhat.com> Date: Wed, 10 Feb 2010 15:52:54 -0500 From: Rik van Riel Organization: Red Hat, Inc User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.5) Gecko/20091209 Fedora/3.0-4.fc12 Lightning/1.0pre Thunderbird/3.0 MIME-Version: 1.0 To: David Rientjes CC: Andrew Morton , KAMEZAWA Hiroyuki , Nick Piggin , Andrea Arcangeli , Balbir Singh , Lubos Lunak , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [patch 2/7 -mm] oom: sacrifice child with highest badness score for parent References: In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1677 Lines: 34 On 02/10/2010 11:32 AM, David Rientjes wrote: > When a task is chosen for oom kill, the oom killer first attempts to > sacrifice a child not sharing its parent's memory instead. > Unfortunately, this often kills in a seemingly random fashion based on > the ordering of the selected task's child list. Additionally, it is not > guaranteed at all to free a large amount of memory that we need to > prevent additional oom killing in the very near future. > > Instead, we now only attempt to sacrifice the worst child not sharing its > parent's memory, if one exists. The worst child is indicated with the > highest badness() score. This serves two advantages: we kill a > memory-hogging task more often, and we allow the configurable > /proc/pid/oom_adj value to be considered as a factor in which child to > kill. > > Reviewers may observe that the previous implementation would iterate > through the children and attempt to kill each until one was successful > and then the parent if none were found while the new code simply kills > the most memory-hogging task or the parent. Note that the only time > oom_kill_task() fails, however, is when a child does not have an mm or > has a /proc/pid/oom_adj of OOM_DISABLE. badness() returns 0 for both > cases, so the final oom_kill_task() will always succeed. > > Signed-off-by: David Rientjes Acked-by: Rik van Riel -- All rights reversed. -- 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/