login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2010
»
September
»
1
Re: [PATCH 4/5] memcg: lockless update of file stat with move-account safe method
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: KAMEZAWA Hiroyuki
Subject:
Re: [PATCH 4/5] memcg: lockless update of file stat with move-account safe method
Date: Tuesday, August 31, 2010 - 5:31 pm
On Tue, 31 Aug 2010 12:51:18 +0900 Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:
quoted text
> On Wed, 25 Aug 2010 17:10:50 +0900 > KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote: > > > From: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> > > > > At accounting file events per memory cgroup, we need to find memory cgroup > > via page_cgroup->mem_cgroup. Now, we use lock_page_cgroup(). > > > > But, considering the context which page-cgroup for files are accessed, > > we can use alternative light-weight mutual execusion in the most case. > > At handling file-caches, the only race we have to take care of is "moving" > > account, IOW, overwriting page_cgroup->mem_cgroup. Because file status > > update is done while the page-cache is in stable state, we don't have to > > take care of race with charge/uncharge. > > > > Unlike charge/uncharge, "move" happens not so frequently. It happens only when > > rmdir() and task-moving (with a special settings.) > > This patch adds a race-checker for file-cache-status accounting v.s. account > > moving. The new per-cpu-per-memcg counter MEM_CGROUP_ON_MOVE is added. > > The routine for account move > > 1. Increment it before start moving > > 2. Call synchronize_rcu() > > 3. Decrement it after the end of moving. > > By this, file-status-counting routine can check it needs to call > > lock_page_cgroup(). In most case, I doesn't need to call it. > > > > Changelog: 20100825 > > - added a comment about mc.lock > > - fixed bad lock. > > Changelog: 20100804 > > - added a comment for possible optimization hint. > > Changelog: 20100730 > > - some cleanup. > > Changelog: 20100729 > > - replaced __this_cpu_xxx() with this_cpu_xxx > > (because we don't call spinlock) > > - added VM_BUG_ON(). > > > > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> > > (snip) > > > @@ -1505,29 +1551,36 @@ void mem_cgroup_update_file_mapped(struc > > { > > struct mem_cgroup *mem; > > struct page_cgroup *pc; > > + bool need_lock = false; > > > > pc = lookup_page_cgroup(page); > > if (unlikely(!pc)) > > return; > > - > > - lock_page_cgroup(pc); > > + rcu_read_lock(); > > mem = id_to_memcg(pc->mem_cgroup, true); > It doesn't cause any problem, but I think it would be better to change this to > "id_to_memcg(..., false)". It's just under rcu_read_lock(), not under page_cgroup > lock anymore. >
ok, I'll apply your suggestion.
quoted text
> Otherwise, it looks good to me. > > Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> >
Thanks! -Kame --
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 0/5] memcg: towards I/O aware memcg v6.
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:04 am)
[PATCH 1/5] cgroup: do ID allocation under css allocator.
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:06 am)
[PATCH 2/5] memcg: quick memcg lookup array
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:07 am)
[PATCH 3/5] memcg: use ID instead of pointer in page_cgroup
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:09 am)
[PATCH 4/5] memcg: lockless update of file stat with move- ...
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:10 am)
[PATCH 5/5] memcg: generic file stat accounting interface
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 1:11 am)
Re: [PATCH 1/5] cgroup: do ID allocation under css allocator.
, Balbir Singh
, (Wed Aug 25, 7:15 am)
Re: [PATCH 1/5] cgroup: do ID allocation under css allocator.
, KAMEZAWA Hiroyuki
, (Wed Aug 25, 5:13 pm)
Re: [PATCH 1/5] cgroup: do ID allocation under css allocator.
, Daisuke Nishimura
, (Sun Aug 29, 10:44 pm)
Re: [PATCH 2/5] memcg: quick memcg lookup array
, Daisuke Nishimura
, (Mon Aug 30, 1:03 am)
Re: [PATCH 3/5] memcg: use ID instead of pointer in page_c ...
, Daisuke Nishimura
, (Mon Aug 30, 7:14 pm)
Re: [PATCH 4/5] memcg: lockless update of file stat with m ...
, Daisuke Nishimura
, (Mon Aug 30, 8:51 pm)
Re: [PATCH 5/5] memcg: generic file stat accounting interface
, Daisuke Nishimura
, (Mon Aug 30, 9:33 pm)
Re: [PATCH 1/5] cgroup: do ID allocation under css allocator.
, Balbir Singh
, (Mon Aug 30, 11:33 pm)
Re: [PATCH 2/5] memcg: quick memcg lookup array
, Balbir Singh
, (Tue Aug 31, 12:14 am)
Re: [PATCH 2/5] memcg: quick memcg lookup array
, KAMEZAWA Hiroyuki
, (Tue Aug 31, 5:21 pm)
Re: [PATCH 2/5] memcg: quick memcg lookup array
, KAMEZAWA Hiroyuki
, (Tue Aug 31, 5:29 pm)
Re: [PATCH 4/5] memcg: lockless update of file stat with m ...
, KAMEZAWA Hiroyuki
, (Tue Aug 31, 5:31 pm)
Re: [PATCH 5/5] memcg: generic file stat accounting interface
, KAMEZAWA Hiroyuki
, (Tue Aug 31, 5:31 pm)
Navigation
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
Mel Gorman
Re: [PATCH 1/4] vmstat: remove zone->lock from walk_zones_in_node
Guenter Roeck
Re: [lm-sensors] Location for thermal drivers
David Woodhouse
Re: RFC: Moving firmware blobs out of the kernel.
Siddha, Suresh B
Re: [PATCH 2.6.21 review I] [11/25] x86: default to physical mode on hotplug CPU k...
Peter Zijlstra
Re: [patch 4/6] mm: merge populate and nopage into fault (fixes nonlinear)
git-commits-head
:
Linux Kernel Mailing List
[MIPS] Fix potential latency problem due to non-atomic cpu_wait.
Linux Kernel Mailing List
USB: rename USB_SPEED_VARIABLE to USB_SPEED_WIRELESS
Linux Kernel Mailing List
lib/vsprintf.c: fix bug omitting minus sign of numbers (module_param)
Linux Kernel Mailing List
[Bluetooth] Initiate authentication during connection establishment
Linux Kernel Mailing List
[POWERPC] 4xx: Add ppc40x_defconfig
linux-netdev
:
MERCEDES
Your mail id has won 950,000.00 in the MERCEDES Benz Online Promo.for claims send:
David Miller
Re: [PATCH] xen/netfront: do not mark packets of length < MSS as GSO
David Miller
Re: skb_segment() questions
Shan Wei
[RFC PATCH net-next 2/5]IPv6:netfilter: Send an ICMPv6 "Fragment Reassembly Timeou...
Stanislaw Gruszka
[PATCH 1/4] bnx2x: use smp_mb() to keep ordering of read write operations
git
:
Nicolas Sebrecht
git-svn died of signal 11 (was "3 failures on test t9100 (svn)")
Junio C Hamano
Re: [PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
Martin Langhoff
Re: [PATCH] GIT commit statistics.
Alexandre Julliard
[PATCH] gitweb: Put back shortlog instead of graphiclog in the project list.
Josh Triplett
[PATCH 2/2] Add url.<base>.pushInsteadOf: URL rewriting for push only
openbsd-misc
:
Taisto Qvist XX
Re: AMD GEODE LX-800 just works with kernel from install42.iso and kernelpanics wi...
Nico Meijer
Re: gOS Develop Kit with VIA pc-1 Processor Platform VIA C7-D
Andreas Bihlmaier
Re: jetway board sensors (Fintek F71805F)
admin
Drive a 2009 car from R799p/m
Antti Harri
Re: how to create a sha256 hash
Colocation donated by:
Syndicate