login
Login
/
Register
Search
Search this site:
Forums
News
Blogs
Features
Site
Home
»
Mailing list archives
»
linux-kernel
»
2008
»
September
»
29
Re: [PATCH 4/4] memcg: optimze cpustat
view
thread
Previous message: [
thread
] [
date
] [
author
]
Next message: [
thread
] [
date
] [
author
]
[view in full thread]
From: Daisuke Nishimura
Subject:
Re: [PATCH 4/4] memcg: optimze cpustat
Date: Monday, September 29, 2008 - 4:44 am
On Mon, 29 Sep 2008 19:24:30 +0900, KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> wrote:
quoted text
> Some obvious optimization to memcg. > > I found mem_cgroup_charge_statistics() is a little big (in object) and > does unnecessary address calclation. > This patch is for optimization to reduce the size of this function. > > And res_counter_charge() is 'likely' to success. > > Changlog: v5->v6 > - patch series was reordered and needs some adjustment. no changes in logic. > Changelog v3->v4: > - merged with an other leaf patch. > > Signed-off-by: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com> > Acked-by: Balbir Singh <balbir@linux.vnet.ibm.com> > >
Reviewed-by: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> I'll test with all the patches applied tonight. Thanks, Daisuke Nishimura.
quoted text
> mm/memcontrol.c | 18 ++++++++++-------- > 1 file changed, 10 insertions(+), 8 deletions(-) > > Index: mmotm-2.6.27-rc7+/mm/memcontrol.c > =================================================================== > --- mmotm-2.6.27-rc7+.orig/mm/memcontrol.c > +++ mmotm-2.6.27-rc7+/mm/memcontrol.c > @@ -66,11 +66,10 @@ struct mem_cgroup_stat { > /* > * For accounting under irq disable, no need for increment preempt count. > */ > -static void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat *stat, > +static inline void __mem_cgroup_stat_add_safe(struct mem_cgroup_stat_cpu *stat, > enum mem_cgroup_stat_index idx, int val) > { > - int cpu = smp_processor_id(); > - stat->cpustat[cpu].count[idx] += val; > + stat->count[idx] += val; > } > > static s64 mem_cgroup_read_stat(struct mem_cgroup_stat *stat, > @@ -190,18 +189,21 @@ static void mem_cgroup_charge_statistics > { > int val = (charge)? 1 : -1; > struct mem_cgroup_stat *stat = &mem->stat; > + struct mem_cgroup_stat_cpu *cpustat; > > VM_BUG_ON(!irqs_disabled()); > + > + cpustat = &stat->cpustat[smp_processor_id()]; > if (flags & PAGE_CGROUP_FLAG_CACHE) > - __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_CACHE, val); > + __mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_CACHE, val); > else > - __mem_cgroup_stat_add_safe(stat, MEM_CGROUP_STAT_RSS, val); > + __mem_cgroup_stat_add_safe(cpustat, MEM_CGROUP_STAT_RSS, val); > > if (charge) > - __mem_cgroup_stat_add_safe(stat, > + __mem_cgroup_stat_add_safe(cpustat, > MEM_CGROUP_STAT_PGPGIN_COUNT, 1); > else > - __mem_cgroup_stat_add_safe(stat, > + __mem_cgroup_stat_add_safe(cpustat, > MEM_CGROUP_STAT_PGPGOUT_COUNT, 1); > } > > @@ -558,7 +560,7 @@ static int mem_cgroup_charge_common(stru > css_get(&memcg->css); > } > > - while (res_counter_charge(&mem->res, PAGE_SIZE)) { > + while (unlikely(res_counter_charge(&mem->res, PAGE_SIZE))) { > if (!(gfp_mask & __GFP_WAIT)) > goto out; > >
--
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/4] memcg: ready-to-go series (was memcg update v6)
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 3:19 am)
[PATCH 1/4] memcg: account swap cache under lock
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 3:21 am)
[PATCH 2/4] memcg: set page->mapping NULL before uncharge
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 3:22 am)
[PATCH 3/4] memcg: avoid account not-on-LRU pages
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 3:23 am)
[PATCH 4/4] memcg: optimze cpustat
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 3:24 am)
Re: [PATCH 3/4] memcg: avoid account not-on-LRU pages
, Daisuke Nishimura
, (Mon Sep 29, 4:19 am)
Re: [PATCH 1/4] memcg: account swap cache under lock
, Daisuke Nishimura
, (Mon Sep 29, 4:33 am)
Re: [PATCH 2/4] memcg: set page->mapping NULL before uncharge
, Daisuke Nishimura
, (Mon Sep 29, 4:39 am)
Re: [PATCH 4/4] memcg: optimze cpustat
, Daisuke Nishimura
, (Mon Sep 29, 4:44 am)
Re: Re: [PATCH 3/4] memcg: avoid account not-on-LRU pages
, kamezawa.hiroyu
, (Mon Sep 29, 4:59 am)
[PATCH/stylefix 3/4] memcg: avoid account not-on-LRU pages
, KAMEZAWA Hiroyuki
, (Mon Sep 29, 6:17 pm)
Re: [PATCH 1/4] memcg: account swap cache under lock
, Balbir Singh
, (Tue Sep 30, 1:05 am)
Re: [PATCH 3/4] memcg: avoid account not-on-LRU pages
, Balbir Singh
, (Tue Sep 30, 1:14 am)
Re: [PATCH/stylefix 3/4] memcg: avoid account not-on-LRU pages
, Balbir Singh
, (Tue Sep 30, 8:49 pm)
Re: [PATCH 2/4] memcg: set page->mapping NULL before uncharge
, Balbir Singh
, (Tue Sep 30, 8:50 pm)
Re: [PATCH/stylefix 3/4] memcg: avoid account not-on-LRU pages
, KAMEZAWA Hiroyuki
, (Tue Sep 30, 9:50 pm)
Re: [PATCH 0/4] memcg: ready-to-go series (was memcg updat ...
, Balbir Singh
, (Mon Oct 6, 10:15 am)
Navigation
Create content
Mailing list archives
Recent posts
Popular discussions
linux-kernel
:
David Howells
[PATCH] KEYS: Use the variable 'key' in keyctl_describe_key()
Dave Jones
Re: OT: character encodings (was: Linux 2.6.20-rc4)
Greg Kroah-Hartman
[PATCH 17/36] sysdev: detect multiple driver registrations
Sam Ravnborg
Re: [PATCH] kbuild: fix make V=1
Nick Piggin
Re: [PATCH 0/24] make atomic_read() behave consistently across all architectures
git
:
Stephen R. van den Berg
Re: [RFC] origin link for cherry-pick and revert
Junio C Hamano
Re: [PATCH 1/2] Teach git-describe to display distances from tags.
Johannes Schindelin
Re: [PATCH 2/2] git-svn: support fetch with autocrlf on
Dan Chokola
Re: how do you "force a pull"?
Junio C Hamano
Re: [PATCH 6/6] Teach core object handling functions about gitlinks
linux-netdev
:
Jan Engelhardt
[PATCH 1/3] net: tcp: make hybla selectable as default congestion module
Jarek Poplawski
Re: [PATCH] flush_work_sync vs. flush_scheduled_work Re: [PATCH] PHYLIB: IRQ event...
Lennert Buytenhek
Re: Distributed Switch Architecture(DSA)
Daniel Schaffrath
Re: tcp bw in 2.6
Matt Mackall
Re: [regression] nf_iterate(), BUG: unable to handle kernel NULL pointer dereference
git-commits-head
:
Linux Kernel Mailing List
ipv6: fix an oops when force unload ipv6 module
Linux Kernel Mailing List
tracing: protect reader of cmdline output
Linux Kernel Mailing List
kconfig: recalc symbol value before showing search results
Linux Kernel Mailing List
KVM: VMX: Clear CR4.VMXE in hardware_disable
Linux Kernel Mailing List
USB-serial: pl2303: fix baud rate handling in case of unsupported values
openbsd-misc
:
Claudio Jeker
Re: Vlan Tag on Vlan Tag (l2tunneling)
Josh Grosse
ssh/sshd challenge-response seems to have stopped working in -current
Pieter Verberne
File collision while using pkg_add
Tomas Bodzar
bsd: uvm_mapent_alloc: out of static map entries
Community First Financial
Teacher A+ Loan
Colocation donated by:
Syndicate