Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753358Ab0HZBQo (ORCPT ); Wed, 25 Aug 2010 21:16:44 -0400 Received: from fgwmail7.fujitsu.co.jp ([192.51.44.37]:34923 "EHLO fgwmail7.fujitsu.co.jp" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752499Ab0HZBQm (ORCPT ); Wed, 25 Aug 2010 21:16:42 -0400 X-SecurityPolicyCheck-FJ: OK by FujitsuOutboundMailChecker v1.3.1 Date: Thu, 26 Aug 2010 10:11:39 +0900 From: KAMEZAWA Hiroyuki To: David Rientjes Cc: KOSAKI Motohiro , LKML , linux-mm , Andrew Morton , Oleg Nesterov , Minchan Kim Subject: Re: [PATCH 1/2][BUGFIX] oom: remove totalpage normalization from oom_badness() Message-Id: <20100826101139.eb05fe2d.kamezawa.hiroyu@jp.fujitsu.com> In-Reply-To: References: <20100825184001.F3EF.A69D9226@jp.fujitsu.com> <20100826093923.d4ac29b6.kamezawa.hiroyu@jp.fujitsu.com> Organization: FUJITSU Co. LTD. X-Mailer: Sylpheed 3.0.3 (GTK+ 2.10.14; i686-pc-mingw32) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2362 Lines: 74 On Wed, 25 Aug 2010 17:52:06 -0700 (PDT) David Rientjes wrote: > On Thu, 26 Aug 2010, KAMEZAWA Hiroyuki wrote: > > > I'm now trying to write a userspace tool to calculate this, for me. > > Then, could you update documentation ? > > == > > 3.2 /proc//oom_score - Display current oom-killer score > > ------------------------------------------------------------- > > > > This file can be used to check the current score used by the oom-killer is for > > any given . Use it together with /proc//oom_adj to tune which > > process should be killed in an out-of-memory situation. > > == > > > > You'll want to look at section 3.1 of Documentation/filesystems/proc.txt, > which describes /proc/pid/oom_score_adj, not 3.2. > > > add a some documentation like: > > == > > (For system monitoring tool developpers, not for usual users.) > > oom_score calculation is implemnentation dependent and can be modified without > > any caution. But current logic is > > > > oom_score = ((proc's rss + proc's swap) / (available ram + swap)) + oom_score_adj > > > > I'd hesitate to state the formula outside of the implementation and > instead focus on the semantics of oom_score_adj (as a proportion of > available memory compared to other tasks), which I tried doing in section > 3.1. Then, the userspace tool only need be concerned about the units of > oom_score_adj rather than whether rss, swap, or later extentions such as > shm are added. > Hmm. I'll add a text like following to cgroup/memory.txt. O.K. ? == Notes on oom_score and oom_score_adj. oom_score is calculated as oom_score = (taks's proportion of memory) + oom_score_adj. Then, when you use oom_score_adj to control the order of priority of oom, you should know about the amount of memory you can use. So, an approximate oom_score under memcg can be memcg_oom_score = (oom_score - oom_score_adj) * system_memory/memcg's limit + oom_score_adj. And yes, this can be affected by hierarchy control of memcg and calculation will be more complicated. See, oom_disable feature also. == Thanks, -Kame -- 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/