From patchwork Fri Oct 11 10:36:10 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jinliang Zheng X-Patchwork-Id: 13832355 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 70E6ECFD316 for ; Fri, 11 Oct 2024 10:36:33 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CCB936B00AB; Fri, 11 Oct 2024 06:36:32 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C7C376B00AD; Fri, 11 Oct 2024 06:36:32 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B42EA6B00AE; Fri, 11 Oct 2024 06:36:32 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 90B236B00AB for ; Fri, 11 Oct 2024 06:36:32 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id B4A021A10E6 for ; Fri, 11 Oct 2024 10:36:24 +0000 (UTC) X-FDA: 82660967340.16.BC3766E Received: from mail-pj1-f54.google.com (mail-pj1-f54.google.com [209.85.216.54]) by imf03.hostedemail.com (Postfix) with ESMTP id 1D13B2000B for ; Fri, 11 Oct 2024 10:36:28 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jEEQ07ih; spf=pass (imf03.hostedemail.com: domain of alexjlzheng@gmail.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=alexjlzheng@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728642806; 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-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=WeeyjeveEMxHGf8ZHXtt9KSJnd9K4LOjpG4HA7v12xU=; b=OTF1PRttvlrj1uNYM/8Ng4nZsKVaJle5JjKnwBR1iUwwa+f3W52/M7KyJDuJKwjUa7B/Cr mqyQmPRll2XikgJhsMQY/nmO5B9zqW3I2znMuf8SfNxa2T3koC8ZMHizC6+QkzvbzonsGL kYI3bRg2Vmj+jCcQgWOZK2E+QzyCE2Q= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=gmail.com header.s=20230601 header.b=jEEQ07ih; spf=pass (imf03.hostedemail.com: domain of alexjlzheng@gmail.com designates 209.85.216.54 as permitted sender) smtp.mailfrom=alexjlzheng@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728642806; a=rsa-sha256; cv=none; b=cfTcR+lQAH8fFbuGSQtPXslo+DW9NHh1gswki+u6f1kOiIEQUF6cnVyuIPxIlHJKV06ark t43ixYe2XHPeBwk2WpTlsMgkKriA9r5KFENy55444zS0XM5M9JZTtRTZfy0uQa458hHDNT eu9RizVRPmwe39+I6fgRP40XMMzAQ/c= Received: by mail-pj1-f54.google.com with SMTP id 98e67ed59e1d1-2e2e8c8915eso887042a91.3 for ; Fri, 11 Oct 2024 03:36:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1728642989; x=1729247789; darn=kvack.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=WeeyjeveEMxHGf8ZHXtt9KSJnd9K4LOjpG4HA7v12xU=; b=jEEQ07ihIuHglC9LhSbsnMaK1vFVbKrS3Q9QiL+Li1ajLQ45V+9INp4pTN4CnWhBkD AWj+biK+v9n1q0rBjkOu+0ExBApvZZ/xivGojm3K8WpqPO8DGCSqaWY5wuRaozOoIAAI sJ7eyd+Beyq9FkqG0EhzaLhObsSkgrzpSBCqHrA9UFYVWp1n8A0Yq82hiGExlBLqoUyh 4v/6ONPzctRtk6M4jIwCR9S4QR8YF0xK8ubj7uWDqvboIHd/I7b4+hqHByIdWWlMhYk2 CUbIIhLG7MfDVzji9WiJGDE6e3nCtcA4Rdaxxr8u2WHuRoJauE/nP0Y6FgC3msaLQSH4 imSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1728642989; x=1729247789; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=WeeyjeveEMxHGf8ZHXtt9KSJnd9K4LOjpG4HA7v12xU=; b=fcRkMumuhD3x1rNiVB+WgR8KfaUTKSH9iRe4CUsfKDXPraIXycRCbstm1nvbjV8ff7 dLaB1fShmv/FWsqs/+tj+QEfq1FmJMFvhedgdNDGVvsuDYXIxT5ofrLgMFnrxLUdzB4O fmCRD3dsvTp25MbpdRHjB7/+k85Ye6ZNzl36am1u7MVpTy1N74Ny5JHmSIVU23wt7T0L /Q8C1YQ5qSQLLJCYhZOmRWNknsV+F3WrAWR1zNwh1xPWYfsJXCmeH3FtPGn96jId8Hep RuziAsfFzlDUIk84f6Cc9wclNIBXpVhamEs7N5kpq3MThCW/WKI9MbEyDUOwnJNb+beR Xczw== X-Gm-Message-State: AOJu0YwW9kg9NmEo/OOdhBTNzEE6dwvArccPt9fcVwx+b+UQzE5zKiul lej3/0F1PkyMuljsEJTRQXc+5eJtdYAxVSaGI6HEEYciqZ8616H0 X-Google-Smtp-Source: AGHT+IH8m6/2cucqCJrNv0+6/VSKuLfjNdMCRcGA7sJqcjDMQvMmg3o5/YZKWOWoM4OhyGN6DuZnxQ== X-Received: by 2002:a17:90a:2dc4:b0:2e2:b41b:854e with SMTP id 98e67ed59e1d1-2e2f0b3c54dmr3186576a91.20.1728642989050; Fri, 11 Oct 2024 03:36:29 -0700 (PDT) Received: from localhost.localdomain ([14.22.11.162]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e2cc488249sm3178721a91.50.2024.10.11.03.36.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Oct 2024 03:36:28 -0700 (PDT) From: alexjlzheng@gmail.com X-Google-Original-From: mengensun@tencent.com To: akpm@linux-foundation.org Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, alexjlzheng@tencent.com, MengEn Sun Subject: [PATCH] mm: make pcp decay work with onhz Date: Fri, 11 Oct 2024 18:36:10 +0800 Message-Id: <20241011103609.1992042-1-mengensun@tencent.com> X-Mailer: git-send-email 2.39.3 MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1D13B2000B X-Stat-Signature: h5ayogfnahhqk93hzzqy78w4x46xdgfs X-Rspam-User: X-HE-Tag: 1728642988-750982 X-HE-Meta: U2FsdGVkX1+LRF7ZuoPkNAbER+U7bauTPGFL/ZuI/Q0U70LBZSaHLbU/j56OSdIG8DTHybEYv2Mb42YJ4jbK7UHH6S8nVuoATkvpBCJicUC5IwR+ueTLTjIL9F0WyIPkNVQmgHO7d+6aVroJhjqvkZuf4MEqaqbogVxch+T/xq2iG6kPBipkfo8IzO5PqGM/g5+iNkhUiX4Ef0/KpdVbe951tHgR81MOM9xLgGtUvCoHmtvHnLax4mrLlOre5Ysacz9hHmVOgMPDXN9rcmgZMMB7I1SMjJM5xSCZo1YDtmIVNL1xWjo8U8o0/mGaM9h0HBZTFHNYVcYifQyU7wxqbz0EZQtBE5A+GOHmxn+1VYKl90PtIxjw/+oJqUE7rf9FlbsK/iliqpZ3DNkZ65alTYJZCsbHfMdLnz4LZ30mkGYzOU9O91cfzuUSJBZRuq/z8kT4OaJfnr1R+FbSBXX007c3q+0b1STb2yZvDE/WbrZQftEJLalSnv3sYwFoNanyL0IBEOxRwWpk5BspA+3MIgmp+MeZ5u9M0NUFgtPhYkBj0mwhe2F4Tf+wQOcDiKnovzVkIi18uZRABcbJTkzvTy0fQrQqMVjdfFTWQIjtfU8ESt1guq5uBJRRiiJHyfO44RYwOjnWSfu5IZP6656J2RQ88A1pz97c6UVVIZIVfrxlfcYD/UkTTvE+3B0bNRgtVmCUrvFPCmSUqztX1FKLvdwkxRU6Laep5rUVoxoSFRu77S98XBIdMup0JLSHL+prXfS3klrIqqqCJTw3BlOhFOglKUP6NrvsEvwk+dV62Kl+uBWFYXBZuv+0xGrCjop1pHu9RKDIp0TifCEQvcvYlD+amEn1grX+I7lcSGh/+ykOHob5ZcbnudTYe1KHC4qrR9NPhn76POY4hVaKptSX1H48TigBLSaKOzPacVvC/DdpYlS5tHMfwXbGRGqqbeYzDAMeOHy1XQDqyHSY3SC ZiDTcBXC S8XKxVsJeQy9n2DYCqYHsS/MxJBDOqosNxxsHnE4koVbyCKTjj1MQO1Td0/E5rXvlhXY0FWSSO5sypegYMv+MGpwz5cZHysE/gPzMbH5tQS6v5IrJ4bPPFd4xBeNd7t1O27iQIHxuNedBfvD6kx1dKr6n32OW9H+lcZhXP01GwyR7ZxyLqr4lCha3JvQca3iUCkVYkXylyKNWQywU45BSLaEnci1Dc3lpKVIL53AUhFsF1/OtDn7b66g76TAzh2MPqkfYOdVfK/YDCOYwuu68gY6y+vQIytiDosQxQ4OOxb2lcQ3rOWwP29BYaCJP8nrFDd0uFWtWoO++6EupStqKDED1lhwnohWgo8qBLK1g5YSicRY= X-Bogosity: Ham, tests=bogofilter, spamicity=0.057223, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: From: MengEn Sun 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 Signed-off-by: MengEn Sun --- 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. */