lkml.org 
[lkml]   [2020]   [Jul]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v4 02/13] task_isolation: vmstat: add vmstat_idle function
    Date
    From 7823be8cd3ba2e66308f334a2e47f60ba7829e0b Mon Sep 17 00:00:00 2001
    From: Chris Metcalf <cmetcalf@mellanox.com>
    Date: Sat, 1 Feb 2020 08:05:45 +0000
    Subject: [PATCH 02/13] task_isolation: vmstat: add vmstat_idle function

    This function checks to see if a vmstat worker is not running,
    and the vmstat diffs don't require an update. The function is
    called from the task-isolation code to see if we need to
    actually do some work to quiet vmstat.

    Signed-off-by: Chris Metcalf <cmetcalf@mellanox.com>
    Signed-off-by: Alex Belits <abelits@marvell.com>
    ---
    include/linux/vmstat.h | 2 ++
    mm/vmstat.c | 10 ++++++++++
    2 files changed, 12 insertions(+)

    diff --git a/include/linux/vmstat.h b/include/linux/vmstat.h
    index ded16dfd21fa..97bc9ed92036 100644
    --- a/include/linux/vmstat.h
    +++ b/include/linux/vmstat.h
    @@ -273,6 +273,7 @@ extern void __dec_node_state(struct pglist_data *, enum node_stat_item);

    void quiet_vmstat(void);
    void quiet_vmstat_sync(void);
    +bool vmstat_idle(void);
    void cpu_vm_stats_fold(int cpu);
    void refresh_zone_stat_thresholds(void);

    @@ -376,6 +377,7 @@ static inline void refresh_zone_stat_thresholds(void) { }
    static inline void cpu_vm_stats_fold(int cpu) { }
    static inline void quiet_vmstat(void) { }
    static inline void quiet_vmstat_sync(void) { }
    +static inline bool vmstat_idle(void) { return true; }

    static inline void drain_zonestat(struct zone *zone,
    struct per_cpu_pageset *pset) { }
    diff --git a/mm/vmstat.c b/mm/vmstat.c
    index 93534f8537ca..f3693ef0a958 100644
    --- a/mm/vmstat.c
    +++ b/mm/vmstat.c
    @@ -1898,6 +1898,16 @@ void quiet_vmstat_sync(void)
    refresh_cpu_vm_stats(false);
    }

    +/*
    + * Report on whether vmstat processing is quiesced on the core currently:
    + * no vmstat worker running and no vmstat updates to perform.
    + */
    +bool vmstat_idle(void)
    +{
    + return !delayed_work_pending(this_cpu_ptr(&vmstat_work)) &&
    + !need_update(smp_processor_id());
    +}
    +
    /*
    * Shepherd worker thread that checks the
    * differentials of processors that have their worker
    --
    2.26.2
    \
     
     \ /
      Last update: 2020-07-22 16:50    [W:5.833 / U:0.712 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site