From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-113.freemail.mail.aliyun.com (out30-113.freemail.mail.aliyun.com [115.124.30.113]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 86F8742AA4 for ; Wed, 30 Jul 2025 01:28:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.113 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753838940; cv=none; b=YoTEkLWabaj/rzQsDfwRtNd6xrFv3eCvu7tM1zCJI5H+t/hFyEpCkEHcj6zOY+4f6v/JomUNlxSLnbrPaM/QtU3MHDP4VBPH5H8ewPUiGWJhJRLIMyflU+F3YYrr3cgEw051XP8gmfujU4WPchZEtunTQVD5oXBLP2Wv0OXfj2Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1753838940; c=relaxed/simple; bh=d+qF/Z3fd/0yM9JwsY4cVdQ8jqZKXR4nojLiv/tbImI=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=VYwPD+oHTP4Ypza35ZBjpwSn1rHX++VLUZv35T+NoV3J6U8lLBD+AlNBBs4oYxdo624a4tzegU75dzR0f/Ggds3XcFhvE42QYEjMJgBCzBgAQGTYDKPDHUHjo+0GddTfTkyAD5/4dQuGdHwBK8nqwfjI+QEhRlXQC+qbOBjOHr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=rM3lIhv+; arc=none smtp.client-ip=115.124.30.113 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="rM3lIhv+" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1753838929; h=From:To:Subject:Date:Message-ID:MIME-Version:Content-Type; bh=uVXUL3SYY4u26un88JxM93aVATKWntzTTRFMmp2lyOE=; b=rM3lIhv+8qub+ridQ8efp73LGn5n3NU9wy1UAkDxWTOPqZTf6Jde0B536tNL72ZHtbhEDwD28GLn4L3OjjoXPbUPl29/Uw2YqE/eQDVpSRMk6xXYhZd4JkPBVZTeH1yfLqN5uibv/7rITPHaf3wArj28+8PKx6xoU4n+OwVd+D8= Received: from DESKTOP-5N7EMDA(mailfrom:ying.huang@linux.alibaba.com fp:SMTPD_---0WkSRRoH_1753838927 cluster:ay36) by smtp.aliyun-inc.com; Wed, 30 Jul 2025 09:28:47 +0800 From: "Huang, Ying" To: Ruan Shiyang Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, lkp@intel.com, akpm@linux-foundation.org, y-goto@fujitsu.com, mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, mgorman@suse.de, vschneid@redhat.com, Ben Segall , Li Zhijian Subject: Re: [PATCH v1] mm: memory-tiering: Fix PGPROMOTE_CANDIDATE counting In-Reply-To: <20250729035101.1601407-1-ruansy.fnst@fujitsu.com> (Ruan Shiyang's message of "Tue, 29 Jul 2025 11:51:01 +0800") References: <20250729035101.1601407-1-ruansy.fnst@fujitsu.com> Date: Wed, 30 Jul 2025 09:28:45 +0800 Message-ID: <874iuuzctu.fsf@DESKTOP-5N7EMDA> User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=ascii Ruan Shiyang writes: > Goto-san reported confusing pgpromote statistics where the > pgpromote_success count significantly exceeded pgpromote_candidate. > > On a system with three nodes (nodes 0-1: DRAM 4GB, node 2: NVDIMM 4GB): > # Enable demotion only > echo 1 > /sys/kernel/mm/numa/demotion_enabled > numactl -m 0-1 memhog -r200 3500M >/dev/null & > pid=$! > sleep 2 > numactl memhog -r100 2500M >/dev/null & > sleep 10 > kill -9 $pid # terminate the 1st memhog > # Enable promotion > echo 2 > /proc/sys/kernel/numa_balancing > > After a few seconds, we observeed `pgpromote_candidate < pgpromote_success` > $ grep -e pgpromote /proc/vmstat > pgpromote_success 2579 > pgpromote_candidate 0 > > In this scenario, after terminating the first memhog, the conditions for > pgdat_free_space_enough() are quickly met, and triggers promotion. > However, these migrated pages are only counted for in PGPROMOTE_SUCCESS, > not in PGPROMOTE_CANDIDATE. > > To solve this confusing statistics, introduce this PGPROMOTE_CANDIDATE_NRL > to count the missed promotion pages. And also, not counting these pages > into PGPROMOTE_CANDIDATE is to avoid changing the existing algorithm or > performance of the promotion rate limit. > > Cc: Ingo Molnar > Cc: Peter Zijlstra > Cc: Juri Lelli > Cc: Vincent Guittot > Cc: Dietmar Eggemann > Cc: Steven Rostedt > Cc: Ben Segall > Cc: Mel Gorman > Cc: Valentin Schneider > Reported-by: Yasunori Gotou (Fujitsu) > Suggested-by: Huang Ying > Signed-off-by: Li Zhijian > Signed-off-by: Ruan Shiyang LGTM, feel free to add my Reviewed-by: Huang Ying in the future version. [snip] --- Best Regards, Huang, Ying