login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
October
»
20
Re: [PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Greg Thelen
Subject:
Re: [PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
Date: Tuesday, October 19, 2010 - 9:08 pm
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> writes:
quoted text
>> +static unsigned long long >> +memcg_hierarchical_free_pages(struct mem_cgroup *mem) >> +{ >> + struct cgroup *cgroup; >> + unsigned long long min_free, free; >> + >> + min_free = res_counter_read_u64(&mem->res, RES_LIMIT) - >> + res_counter_read_u64(&mem->res, RES_USAGE); >> + cgroup = mem->css.cgroup; >> + if (!mem->use_hierarchy) >> + goto out; >> + >> + while (cgroup->parent) { >> + cgroup = cgroup->parent; >> + mem = mem_cgroup_from_cont(cgroup); >> + if (!mem->use_hierarchy) >> + break; >> + free = res_counter_read_u64(&mem->res, RES_LIMIT) - >> + res_counter_read_u64(&mem->res, RES_USAGE); >> + min_free = min(min_free, free); >> + } >> +out: >> + /* Translate free memory in pages */ >> + return min_free >> PAGE_SHIFT; >> +} >> + > I think you can simplify this function using parent_mem_cgroup(). > > unsigned long free, min_free = ULLONG_MAX; > > while (mem) { > free = res_counter_read_u64(&mem->res, RES_LIMIT) - > res_counter_read_u64(&mem->res, RES_USAGE); > min_free = min(min_free, free); > mem = parent_mem_cgroup(); > } > > /* Translate free memory in pages */ > return min_free >> PAGE_SHIFT; > > And, IMHO, we should return min(global_page_state(NR_FREE_PAGES), min_free >> PAGE_SHIFT). > Because we are allowed to set no-limit(or a very big limit) in memcg, > so min_free can be very big if we don't set a limit against all the memcg's in hierarchy. > > > Thanks, > Dasiuke Nishimura.
Thank you. This is a good suggestion. I will update the page to include this. -- Greg --
unsubscribe notice
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/
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
Messages in current thread:
[PATCH v3 00/11] memcg: per cgroup dirty page accounting
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 01/11] memcg: add page_cgroup flags for dirty pa ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 02/11] memcg: document cgroup dirty memory inter ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 03/11] memcg: create extensible page stat update ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 04/11] memcg: add lock to synchronize page accou ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 05/11] memcg: add dirty page accounting infrastr ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 06/11] memcg: add kernel calls for memcg dirty p ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 08/11] memcg: CPU hotplug lockdep warning fix
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 09/11] memcg: add cgroupfs interface to memcg di ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 10/11] writeback: make determine_dirtyable_memor ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
[PATCH v3 11/11] memcg: check memcg dirty limits in page w ...
, Greg Thelen
, (Mon Oct 18, 5:39 pm)
Re: [PATCH v3 04/11] memcg: add lock to synchronize page a ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:45 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:46 pm)
Re: [PATCH v3 03/11] memcg: create extensible page stat up ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:47 pm)
Re: [PATCH v3 05/11] memcg: add dirty page accounting infr ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:49 pm)
Re: [PATCH v3 06/11] memcg: add kernel calls for memcg dir ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:51 pm)
Re: [PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:53 pm)
Re: [PATCH v3 08/11] memcg: CPU hotplug lockdep warning fix
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:54 pm)
Re: [PATCH v3 09/11] memcg: add cgroupfs interface to memc ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:56 pm)
Re: [PATCH v3 10/11] writeback: make determine_dirtyable_m ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 5:57 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 6:00 pm)
Re: [PATCH v3 04/11] memcg: add lock to synchronize page a ...
, Minchan Kim
, (Mon Oct 18, 6:17 pm)
Re: [PATCH v3 01/11] memcg: add page_cgroup flags for dirt ...
, Daisuke Nishimura
, (Mon Oct 18, 9:31 pm)
[RFC][PATCH 1/2] memcg: move_account optimization by redu ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 9:43 pm)
[RFC][PATCH 2/2] memcg: move_account optimization by redu ...
, KAMEZAWA Hiroyuki
, (Mon Oct 18, 9:45 pm)
Re: [PATCH v3 03/11] memcg: create extensible page stat up ...
, Daisuke Nishimura
, (Mon Oct 18, 9:52 pm)
Re: [PATCH v3 04/11] memcg: add lock to synchronize page a ...
, Daisuke Nishimura
, (Mon Oct 18, 10:03 pm)
Re: [PATCH v3 06/11] memcg: add kernel calls for memcg dir ...
, Daisuke Nishimura
, (Tue Oct 19, 12:03 am)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Daisuke Nishimura
, (Tue Oct 19, 1:27 am)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Greg Thelen
, (Tue Oct 19, 2:00 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 5:11 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Greg Thelen
, (Tue Oct 19, 5:45 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Daisuke Nishimura
, (Tue Oct 19, 5:48 pm)
Re: [PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
, Daisuke Nishimura
, (Tue Oct 19, 5:50 pm)
Re: [PATCH v3 05/11] memcg: add dirty page accounting infr ...
, Daisuke Nishimura
, (Tue Oct 19, 5:53 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 6:14 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 7:24 pm)
[PATCH][memcg+dirtylimit] Fix overwriting global vm dirty ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 8:21 pm)
Re: [PATCH v3 09/11] memcg: add cgroupfs interface to memc ...
, Daisuke Nishimura
, (Tue Oct 19, 8:31 pm)
Re: [PATCH v3 09/11] memcg: add cgroupfs interface to memc ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 8:44 pm)
Re: [PATCH v3 09/11] memcg: add cgroupfs interface to memc ...
, Daisuke Nishimura
, (Tue Oct 19, 8:46 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Daisuke Nishimura
, (Tue Oct 19, 8:47 pm)
Re: [PATCH v3 10/11] writeback: make determine_dirtyable_m ...
, Daisuke Nishimura
, (Tue Oct 19, 8:47 pm)
Re: [PATCH v3 08/11] memcg: CPU hotplug lockdep warning fix
, Daisuke Nishimura
, (Tue Oct 19, 8:47 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 9:06 pm)
Re: [PATCH v3 07/11] memcg: add dirty limits to mem_cgroup
, Greg Thelen
, (Tue Oct 19, 9:08 pm)
Re: [PATCH][memcg+dirtylimit] Fix overwriting global vm d ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 9:14 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 9:18 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, Greg Thelen
, (Tue Oct 19, 9:25 pm)
Re: [PATCH v3 02/11] memcg: document cgroup dirty memory i ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 9:26 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 9:33 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, Greg Thelen
, (Tue Oct 19, 9:33 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, Daisuke Nishimura
, (Tue Oct 19, 9:34 pm)
[PATCH v2][memcg+dirtylimit] Fix overwriting global vm di ...
, KAMEZAWA Hiroyuki
, (Tue Oct 19, 10:02 pm)
Re: [PATCH v3 11/11] memcg: check memcg dirty limits in pa ...
, Daisuke Nishimura
, (Tue Oct 19, 10:25 pm)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, Daisuke Nishimura
, (Tue Oct 19, 11:09 pm)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, Minchan Kim
, (Wed Oct 20, 7:35 am)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, KAMEZAWA Hiroyuki
, (Wed Oct 20, 5:10 pm)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, Greg Thelen
, (Sun Oct 24, 11:44 am)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, KAMEZAWA Hiroyuki
, (Sun Oct 24, 5:24 pm)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, Daisuke Nishimura
, (Sun Oct 24, 7:00 pm)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, Ciju Rajan K
, (Mon Oct 25, 12:03 am)
Re: [PATCH v2][memcg+dirtylimit] Fix overwriting global v ...
, KAMEZAWA Hiroyuki
, (Mon Oct 25, 12:08 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Greg KH
Re: [PATCH 1/1] staging: hv: Fix race condition on IC channel initialization (modi...
Brian Swetland
Re: Attempted summary of suspend-blockers LKML thread
Sam Ravnborg
[PATCH 05/11] x86: add X86_64 dependency to x86_64 specific symbols in Kconfig.x86...
Christoph Lameter
Re: [PATCH 02/40] mm: slab allocation fairness
Alexey Dobriyan
Re: [2.6.22.2 review 09/84] Fix rfkill IRQ flags.
git
:
Felipe Contreras
Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins
Paolo Ciarrocchi
Re: [kernel.org users] [RFD] On deprecating "git-foo" for builtins
Sverre Rabbelier
Re: [GSoC] What is status of Git's Google Summer of Code 2008 projects?
Johannes Schindelin
Re: [PATCH] Fix install-doc-quick target
Peter Oberndorfer
Subject: [PATCH] fix stg edit command
linux-netdev
:
Andi Kleen
Re: RFC: Nagle latency tuning
Jarek Poplawski
Re: tc filter flow hash question
David Miller
Re: [RFC 0/5] generic rx recycling
Chuck Lever
Re: [RFC] ipv6: Change %pI6 format to output compacted addresses?
Jarek Poplawski
Re: socket api problem: can't bind an ipv6 socket to ::ffff:0.0.0.0
git-commits-head
:
Linux Kernel Mailing List
New device ID for sc92031 [1088:2031]
Linux Kernel Mailing List
e1000e: Expose MDI-X status via ethtool change
Linux Kernel Mailing List
NFS: Store pages from an NFS inode into a local cache
Linux Kernel Mailing List
powerpc/kexec: Add support for FSL-BookE
Linux Kernel Mailing List
arm/imx/gpio: GPIO_INT_{HIGH,LOW}_LEV are not necessarily constant
openbsd-misc
:
Theo de Raadt
Re: RES: OpenBSD on IBM System X3550 7879
Bret S. Lambert
Re: any web management gui for pf ?
Rob Shepherd
x86 hardware for router system
Leif Blixt
Re: Force passwordcheck in login.conf
ropers
Re: Real men don't attack straw men
Colocation donated by:
Syndicate