diff options
| author | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-02 13:56:48 +0200 | 
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2022-05-02 13:56:48 +0200 | 
| commit | 0e509f537f8ddd89f237e62f77818dbdbc8be395 (patch) | |
| tree | 4e747a1cad81d0c085d435923366bcce30484bc8 /mm/memcontrol.c | |
| parent | f8ae07f4b8bfde0f33761e1a1aaee45a4e85e9d6 (diff) | |
| parent | 672c0c5173427e6b3e2a9bbb7be51ceeec78093a (diff) | |
Merge 5.18-rc5 into driver-core-next
We need the kernfs/driver core fixes in here as well.
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/memcontrol.c')
| -rw-r--r-- | mm/memcontrol.c | 12 | 
1 files changed, 11 insertions, 1 deletions
diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 725f76723220..598fece89e2b 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -587,6 +587,9 @@ static DECLARE_DEFERRABLE_WORK(stats_flush_dwork, flush_memcg_stats_dwork);  static DEFINE_SPINLOCK(stats_flush_lock);  static DEFINE_PER_CPU(unsigned int, stats_updates);  static atomic_t stats_flush_threshold = ATOMIC_INIT(0); +static u64 flush_next_time; + +#define FLUSH_TIME (2UL*HZ)  /*   * Accessors to ensure that preemption is disabled on PREEMPT_RT because it can @@ -637,6 +640,7 @@ static void __mem_cgroup_flush_stats(void)  	if (!spin_trylock_irqsave(&stats_flush_lock, flag))  		return; +	flush_next_time = jiffies_64 + 2*FLUSH_TIME;  	cgroup_rstat_flush_irqsafe(root_mem_cgroup->css.cgroup);  	atomic_set(&stats_flush_threshold, 0);  	spin_unlock_irqrestore(&stats_flush_lock, flag); @@ -648,10 +652,16 @@ void mem_cgroup_flush_stats(void)  		__mem_cgroup_flush_stats();  } +void mem_cgroup_flush_stats_delayed(void) +{ +	if (time_after64(jiffies_64, flush_next_time)) +		mem_cgroup_flush_stats(); +} +  static void flush_memcg_stats_dwork(struct work_struct *w)  {  	__mem_cgroup_flush_stats(); -	queue_delayed_work(system_unbound_wq, &stats_flush_dwork, 2UL*HZ); +	queue_delayed_work(system_unbound_wq, &stats_flush_dwork, FLUSH_TIME);  }  /**  | 
