linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Rik van Riel <riel@redhat.com>, Nick Piggin <npiggin@suse.de>,
	Balbir Singh <balbir@linux.vnet.ibm.com>,
	KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>,
	linux-mm@kvack.org
Subject: Re: [patch 05/10 -mm v3] oom: badness heuristic rewrite
Date: Tue, 16 Mar 2010 18:26:30 -0700 (PDT)	[thread overview]
Message-ID: <alpine.DEB.2.00.1003161821400.14676@chino.kir.corp.google.com> (raw)
In-Reply-To: <20100312152048.e7dc8135.kamezawa.hiroyu@jp.fujitsu.com>

On Fri, 12 Mar 2010, KAMEZAWA Hiroyuki wrote:

> A small concern here.
> 
> +u64 mem_cgroup_get_limit(struct mem_cgroup *memcg)
> +{
> +       return res_counter_read_u64(&memcg->memsw, RES_LIMIT);
> +}
> 
> Because memory cgroup has 2 limit controls as "memory" and "memory+swap",
> a user may set only "memory" limitation. (Especially on swapless system.)
> Then, memcg->memsw limit can be infinite in some situation.
> 
> So, how about this ? (just an idea after breif thinking..)
> 
> u64 mem_cgroup_get_memsw_limit(struct mem_cgroup *memcg)
> {
> 	u64 memlimit, memswlimit;
> 
> 	memlimit = res_counter_read_u64(&memcg->res, RES_LIMIT);
> 	memswlimit = res_counter_read_u64(&memcg->memsw, RES_LIMIT);
> 	if (memlimit + total_swap_pages > memswlimit)
> 		return memswlimit;
> 	return memlimit + total_swap_pages;
> }
> 

I definitely trust your judgment when it comes to memcg, so this is how I 
implemented it for v4.

Is the memcg->memsw RES_LIMIT not initialized to zero for swapless systems 
or when users don't set a value?  In other words, is this the optimal way 
to determine how much resident memory and swap that current's memcg is 
allowed?

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2010-03-17  1:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 10:41 [patch 00/10 -mm v3] oom killer rewrite David Rientjes
2010-03-10 10:41 ` [patch 01/10 -mm v3] oom: filter tasks not sharing the same cpuset David Rientjes
2010-03-10 10:41 ` [patch 02/10 -mm v3] oom: sacrifice child with highest badness score for parent David Rientjes
2010-03-10 10:41 ` [patch 03/10 -mm v3] oom: select task from tasklist for mempolicy ooms David Rientjes
2010-03-10 10:41 ` [patch 04/10 -mm v3] oom: remove special handling for pagefault ooms David Rientjes
2010-03-10 10:41 ` [patch 05/10 -mm v3] oom: badness heuristic rewrite David Rientjes
2010-03-12  6:20   ` KAMEZAWA Hiroyuki
2010-03-17  1:26     ` David Rientjes [this message]
2010-03-17  1:44       ` KAMEZAWA Hiroyuki
2010-03-17  3:30         ` David Rientjes
2010-03-10 10:41 ` [patch 06/10 -mm v3] oom: deprecate oom_adj tunable David Rientjes
2010-03-10 10:41 ` [patch 07/10 -mm v3] oom: replace sysctls with quick mode David Rientjes
2010-03-10 10:41 ` [patch 08/10 -mm v3] oom: avoid oom killer for lowmem allocations David Rientjes
2010-03-10 10:41 ` [patch 09/10 -mm v3] oom: remove unnecessary code and cleanup David Rientjes
2010-03-10 10:41 ` [patch 10/10 -mm v3] oom: default to killing current for pagefault ooms David Rientjes
2010-03-12  7:34 ` [patch 00/10 -mm v3] oom killer rewrite KAMEZAWA Hiroyuki
2010-03-17  1:00   ` David Rientjes
2010-03-12  7:46 ` KAMEZAWA Hiroyuki
2010-03-17  1:21   ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.DEB.2.00.1003161821400.14676@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=balbir@linux.vnet.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@suse.de \
    --cc=riel@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox