linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: alexjlzheng@gmail.com
To: akpm@linux-foundation.org
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	alexjlzheng@tencent.com, MengEn Sun <mengensun@tencent.com>
Subject: [PATCH] mm: make pcp decay work with onhz
Date: Fri, 11 Oct 2024 18:36:10 +0800	[thread overview]
Message-ID: <20241011103609.1992042-1-mengensun@tencent.com> (raw)

From: MengEn Sun <mengensun@tencent.com>

when a cpu stops tick, quiet_vmstat may flush all the per cpu
statistics counter.

while, the shepherd is needed those counters to kick the
vmstat_work.

when a cpu in nohz with a lot of pcp pages, and do not do page
allocating and freeing. the pcp pages of the cpu may not be hold
for a long time

we make shepherd keep a eye on the pcp high_min and high_max

Reviewed-by: Jinliang Zheng <alexjlzheng@tencent.com>
Signed-off-by: MengEn Sun <mengensun@tencent.com>
---
 mm/vmstat.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/mm/vmstat.c b/mm/vmstat.c
index 1917c034c045..32768fb8f769 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -2024,8 +2024,13 @@ static bool need_update(int cpu)
 
 	for_each_populated_zone(zone) {
 		struct per_cpu_zonestat *pzstats = per_cpu_ptr(zone->per_cpu_zonestats, cpu);
+		struct per_cpu_pages *pcp = per_cpu_ptr(zone->per_cpu_pageset, cpu);
 		struct per_cpu_nodestat *n;
 
+		/* in onhz or nohz full make pcp decay work */
+		if (pcp->high_max > pcp->high_min)
+			return true;
+
 		/*
 		 * The fast way of checking if there are any vmstat diffs.
 		 */
-- 
2.43.5



             reply	other threads:[~2024-10-11 10:36 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-11 10:36 alexjlzheng [this message]
2024-10-12 22:43 ` Andrew Morton
2024-10-18  6:06   ` MengEn Sun

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241011103609.1992042-1-mengensun@tencent.com \
    --to=alexjlzheng@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=alexjlzheng@tencent.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mengensun@tencent.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox