Messages in this thread | | | Date | Sat, 27 Nov 2010 10:09:35 +0200 | Subject | Re: [thisops uV2 06/10] vmstat: Use this_cpu_inc_return for vm statistics | From | Pekka Enberg <> |
| |
On Fri, Nov 26, 2010 at 11:09 PM, Christoph Lameter <cl@linux.com> wrote: > this_cpu_inc_return() saves us a memory access there. Code > size does not change. > > V1->V2: > - Fixed the location of the __per_cpu pointer attributes > - Sparse checked > > Signed-off-by: Christoph Lameter <cl@linux.com> > > --- > mm/vmstat.c | 20 ++++++++------------ > 1 file changed, 8 insertions(+), 12 deletions(-) > > Index: linux-2.6/mm/vmstat.c > =================================================================== > --- linux-2.6.orig/mm/vmstat.c 2010-11-26 10:35:45.000000000 -0600 > +++ linux-2.6/mm/vmstat.c 2010-11-26 10:45:49.000000000 -0600 > @@ -167,8 +167,8 @@ static void refresh_zone_stat_thresholds > void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item, > int delta) > { > - struct per_cpu_pageset * __percpu pcp = zone->pageset; > - s8 * __percpu p = pcp->vm_stat_diff + item; > + struct per_cpu_pageset __percpu *pcp = zone->pageset; > + s8 __percpu *p = pcp->vm_stat_diff + item; > long x; > long t; >
Shouldn't this hunk be in the other vmstat patch?
> @@ -223,13 +223,11 @@ EXPORT_SYMBOL(mod_zone_page_state); > */ > void __inc_zone_state(struct zone *zone, enum zone_stat_item item) > { > - struct per_cpu_pageset * __percpu pcp = zone->pageset; > - s8 * __percpu p = pcp->vm_stat_diff + item; > + struct per_cpu_pageset __percpu *pcp = zone->pageset; > + s8 __percpu *p = pcp->vm_stat_diff + item; > s8 v, t; > > - __this_cpu_inc(*p); > - > - v = __this_cpu_read(*p); > + v = __this_cpu_inc_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > if (unlikely(v > t)) { > s8 overstep = t >> 1; > @@ -247,13 +245,11 @@ EXPORT_SYMBOL(__inc_zone_page_state); > > void __dec_zone_state(struct zone *zone, enum zone_stat_item item) > { > - struct per_cpu_pageset * __percpu pcp = zone->pageset; > - s8 * __percpu p = pcp->vm_stat_diff + item; > + struct per_cpu_pageset __percpu *pcp = zone->pageset; > + s8 __percpu *p = pcp->vm_stat_diff + item; > s8 v, t; > > - __this_cpu_dec(*p); > - > - v = __this_cpu_read(*p); > + v = __this_cpu_dec_return(*p); > t = __this_cpu_read(pcp->stat_threshold); > if (unlikely(v < - t)) { > s8 overstep = t >> 1;
For the rest of this patch:
Reviewed-by: Pekka Enberg <penberg@kernel.org> -- 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/
| |