From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CE21D0E6D0 for ; Mon, 21 Oct 2024 08:44:00 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 66FC76B009B; Mon, 21 Oct 2024 04:43:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 620246B009C; Mon, 21 Oct 2024 04:43:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4E7D16B009D; Mon, 21 Oct 2024 04:43:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 2DA296B009B for ; Mon, 21 Oct 2024 04:43:59 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id A9007C177B for ; Mon, 21 Oct 2024 08:43:42 +0000 (UTC) X-FDA: 82696971336.24.46BE851 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) by imf11.hostedemail.com (Postfix) with ESMTP id A6DDD4001E for ; Mon, 21 Oct 2024 08:43:38 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=j1LseV08; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf11.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729500126; a=rsa-sha256; cv=none; b=AkR7rmuuN5Q9oeUreoiw2wISnr4DeRUMas/KgKjAiHXCUhAGqLWQh+CIQifHFmboWvLfr+ DhAdciO1kmZEX8RHJ5D/CDPFXnUHyWSyEnGODuWJf+GLuq5cQI5pYuISCMuSND7VUx9Uwp hFaIEJlL72nw6d+KM6JkbXaXQ7rNAfM= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=intel.com header.s=Intel header.b=j1LseV08; dmarc=pass (policy=none) header.from=intel.com; spf=pass (imf11.hostedemail.com: domain of ying.huang@intel.com designates 198.175.65.11 as permitted sender) smtp.mailfrom=ying.huang@intel.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729500126; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=YeFlO4dkqJpA3jtSmB9RJZteiOj0vCdlyi/jbGj9PEM=; b=wq2WtcR6LLNtt8CExvNxu6oG5cVVLx+aYhHjZQ6mJcsgOU+/VcpxAzkYyCWse0AFI2zbqe BAhNg7gw3bG/roH2Ikn4GMMOBwza0e1EZuYjvHoJpxuvdZsT4fg/gf3iSo/2udOey/vMcq 9RpJAvx0nyTaBfe87/5SvfLDZF1RXtk= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729500236; x=1761036236; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=7NZ5IAV6kJg8ahNCBPuuATIcY4aHBnpr5IMvRSMT+0A=; b=j1LseV08pvHayPFKuY190n2/xgOqaQyvuIjC/FJEF1vbiE6zUHYWsEyT qqcbuf+ujAj8KjW4S6yVJ40e76NDlEqMpeVxQeNCkXa5XV/C3d57+l7zi YrgqLKz9HOAv+FYcHTbV7qc8XWm4HPRATCiTQZwYRdKRscuCKQRNWIPEg GtJe+93XvJAUMm6drcI+3L9A5GcMeSBFwHI+bZZlglWaa4a3RcQl4Tucw 2BYcGR4BFkgyxQU4JJ5VnquTqPy0BFqQdn1RPYQjESkH6rgY6Pha8nHCD C87OZ/BY/6ChgrDda3gqGbj+YkBh2znUrPw4n33c60McgRVSNmw5hUtFc A==; X-CSE-ConnectionGUID: zgdbdbxSTZKIuLpYhd7/8A== X-CSE-MsgGUID: aOUVwHgwT6WIrPtMRnJnug== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="39511171" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="39511171" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 01:43:54 -0700 X-CSE-ConnectionGUID: yTYjJvMgShaNdjahtACFkQ== X-CSE-MsgGUID: GxzvPMRgTqixoeTkjqiWig== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,220,1725346800"; d="scan'208";a="79399878" Received: from yhuang6-desk2.sh.intel.com (HELO yhuang6-desk2.ccr.corp.intel.com) ([10.238.208.55]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Oct 2024 01:43:52 -0700 From: "Huang, Ying" To: mengensun88@gmail.com Cc: akpm@linux-foundation.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexjlzheng@tencent.com, MengEn Sun Subject: Re: [PATCH linux-mm v2] mm: make pcp_decay_high working better with NOHZ full In-Reply-To: <1729238277-26683-1-git-send-email-mengensun@tencent.com> (mengensun's message of "Fri, 18 Oct 2024 15:57:57 +0800") References: <1729238277-26683-1-git-send-email-mengensun@tencent.com> Date: Mon, 21 Oct 2024 16:40:19 +0800 Message-ID: <87msix6e8c.fsf@yhuang6-desk2.ccr.corp.intel.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=ascii X-Rspamd-Queue-Id: A6DDD4001E X-Rspam-User: X-Rspamd-Server: rspam05 X-Stat-Signature: jcwo1i8fsuc6g8ib5wx3qwpjkngnxn1b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CwcHVbv3xWh7/eHO+sT8cfB0q88cVLRwY1W1T8f/01DKlTtvHaixUTMQ/u8q0lfRud+hSYLvdGreh1TpWxWAoXLd01hshMdHuPoMaCNqt7dvJpofJXefjGS+HzynAfVhZZahtqKDkVexX9pI/EX2subEmYmiZ41XpCimTKUuidBp2lnH8dppjyJKfeI0sn8cQAGeLTisf37qrO1y0j/GKmkXQHd3A0RSWJINOWh2iGJaSZzjjhBrONOBSsfEcdYtf+0CJgCz8YQiaa9/2i8QIPZxFYBZHdkol5b374A== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Hi, Mengen, mengensun88@gmail.com writes: > From: MengEn Sun > > When a cpu entring NOHZ full, quiet_vmstat may flush percpu > zonestats and nodestats. > > The vmstat_shepherd only check percpu zonestats and nodestats > to determine whether it is necessary to fire vmstat_update on > the target cpu for now. > > If a process on a certain CPU allocates a large amount of memory, > then frees that memory, and subsequently the CPU enters NOHZ, and > the process not freeing and allocating memory anymore,the > vmstat_update not being executed on the cpu. Because > vmstat_shepherd may not see zonestats and nodestats of the cpu > changed, so may resulting in vmstat_update on the cpu not fired > for a long time. The issue description is too long, can you make it a little shorter? And can you correct your grammar with some tool? Something like chatgpt is good for that, e.g., "fix the grammar of the following text: ...". To make variable and function name distinct, I personally prefer to add "()" after the function name. Have verified the issue with some test? If not, I suggest you to do that. > While, This seems to be fine: > - if freeing and allocating memory occur later, it may the > high_max may be adjust automatically > - If memory is tight, the memory reclamation process will > release the pcp This could be a real issue for me. > Whatever, we make vmstat_shepherd to checking whether we need > decay pcp high_max, and fire pcp_decay_high early if we need. > > Fixes: 51a755c56dc0 ("mm: tune PCP high automatically") > Reviewed-by: Jinliang Zheng > Signed-off-by: MengEn Sun > --- > changelog: > v1: https://lore.kernel.org/lkml/20241012154328.015f57635566485ad60712f3@linux-foundation.org/T/#t > v2: Make the commit message clearer by adding some comments. > --- > mm/vmstat.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/mm/vmstat.c b/mm/vmstat.c > index 1917c034c045..07b494b06872 100644 > --- a/mm/vmstat.c > +++ b/mm/vmstat.c > @@ -2024,8 +2024,17 @@ 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; > > + /* per_cpu_nodestats and per_cpu_zonestats maybe flush when cpu > + * entering NOHZ full, see quiet_vmstat. so, we check pcp > + * high_{min,max} to determine whether it is necessary to run > + * decay_pcp_high on the corresponding CPU > + */ Please follow the comments coding style. /* * comments line 1 * comments line 2 */ > + if (pcp->high_max > pcp->high_min) > + return true; > + We don't tune pcp->high_max/min in fact. Instead, we tune pcp->high. Your code may make need_update() return true in most cases. > /* > * The fast way of checking if there are any vmstat diffs. > */ -- Best Regards, Huang, Ying