lkml.org 
[lkml]   [2008]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[-mm][PATCH 2/5] introduce get_vm_event()
    introduce get_vm_event() new function for easy use vm statics.


    Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>

    ---
    include/linux/vmstat.h | 7 ++++++-
    mm/vmstat.c | 14 ++++++++++++++
    2 files changed, 20 insertions(+), 1 deletion(-)

    Index: b/include/linux/vmstat.h
    ===================================================================
    --- a/include/linux/vmstat.h 2008-05-02 23:40:39.000000000 +0900
    +++ b/include/linux/vmstat.h 2008-05-03 00:23:17.000000000 +0900
    @@ -92,6 +92,8 @@ static inline void vm_events_fold_cpu(in
    }
    #endif

    +unsigned long get_vm_event(enum vm_event_item event_type);
    +
    #else

    /* Disable counters */
    @@ -113,7 +115,10 @@ static inline void all_vm_events(unsigne
    static inline void vm_events_fold_cpu(int cpu)
    {
    }
    -
    +static inline unsigned long get_vm_event(enum vm_event_item event_type)
    +{
    + return 0;
    +}
    #endif /* CONFIG_VM_EVENT_COUNTERS */

    #define __count_zone_vm_events(item, zone, delta) \
    Index: b/mm/vmstat.c
    ===================================================================
    --- a/mm/vmstat.c 2008-05-02 23:40:39.000000000 +0900
    +++ b/mm/vmstat.c 2008-05-02 23:43:28.000000000 +0900
    @@ -46,6 +46,20 @@ void all_vm_events(unsigned long *ret)
    }
    EXPORT_SYMBOL_GPL(all_vm_events);

    +unsigned long get_vm_event(enum vm_event_item event_type)
    +{
    + int cpu;
    + unsigned long ret = 0;
    +
    + for_each_cpu_mask(cpu, cpu_online_map) {
    + struct vm_event_state *this = &per_cpu(vm_event_states, cpu);
    +
    + ret += this->event[event_type];
    + }
    +
    + return ret;
    +}
    +
    #ifdef CONFIG_HOTPLUG
    /*
    * Fold the foreign cpu events into our own.



    \
     
     \ /
      Last update: 2008-05-04 15:01    [W:2.790 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site