lkml.org 
[lkml]   [2010]   [Nov]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[thisops uV2 06/10] vmstat: Use this_cpu_inc_return for vm statistics
    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;

    @@ -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;


    \
     
     \ /
      Last update: 2010-11-26 22:13    [W:0.039 / U:0.044 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site