From patchwork Tue Jan 7 00:03:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13927911 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 68656E77188 for ; Tue, 7 Jan 2025 00:04:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 421CF6B00CA; Mon, 6 Jan 2025 19:04:02 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 3834D6B00CB; Mon, 6 Jan 2025 19:04:02 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09A8D6B00CC; Mon, 6 Jan 2025 19:04:02 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id D976E6B00CA for ; Mon, 6 Jan 2025 19:04:01 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 91C0E14053A for ; Tue, 7 Jan 2025 00:04:01 +0000 (UTC) X-FDA: 82978707882.05.F902484 Received: from mail-qv1-f47.google.com (mail-qv1-f47.google.com [209.85.219.47]) by imf27.hostedemail.com (Postfix) with ESMTP id C6C234000B for ; Tue, 7 Jan 2025 00:03:59 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=ss92SRMJ; dmarc=none; spf=pass (imf27.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.47 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1736208239; a=rsa-sha256; cv=none; b=6m/a/pz3yOxBVOJ4OZ1xnA8eHRjB9XbLFpQjOutdgKEIT18IbPjj8zqoToAHI5V+0gMppR KLFxcwmjPg39DHlQkwfU+OwDgMzHU2Pdtyn9P73LwknDd4wtQ+cQA8JUBSPQMgsV5arl1I R0P8duZCTbVvnvgJYSTetZFuuVrJgbQ= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=ss92SRMJ; dmarc=none; spf=pass (imf27.hostedemail.com: domain of gourry@gourry.net designates 209.85.219.47 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1736208239; 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:in-reply-to:references:references:dkim-signature; bh=EsdX3K0L6RUajk4aeowkzYla6EH2ycdI9VpsUm/ueEE=; b=vm7UQyk7PUiQpW4PTrM6xYwioCtacmO3SMm69+7T+RmdyKGkm4rgCv1mxSMkY146kVFLW1 +Cg5frzc/VwFf/QF+IeXK38dwVpZjaQ8shpJaDfoIKSZzr6zhvqVfwkWMlkzCmjfJ926Os PjETAjP5oZ/75kdvHY9MwJSN/zFvzmg= Received: by mail-qv1-f47.google.com with SMTP id 6a1803df08f44-6d8f99cb0d9so121178896d6.0 for ; Mon, 06 Jan 2025 16:03:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1736208239; x=1736813039; darn=kvack.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=EsdX3K0L6RUajk4aeowkzYla6EH2ycdI9VpsUm/ueEE=; b=ss92SRMJt+mUm/NGq17BpbixU08ONkGOp/Nwv/AZctjz9UkPwzgaEhCxf4JGele3x1 iVIfgnEAZmCNjyLneEtbWuovwmjxobKXA6j5yLy/xyrCrF5FiZDnoD5rlvw2GWHXuzoW 4h72oCVBVJv/R/yUiIKV81oEBDP45f+3+X/hskrqK79GQJxs52wef/2pgzql+gbCvfAZ CP8sJm7+cacZewAxtMQJ9zbAtHmIDJz8gGFJqW5Q+nzQMqNpVslWVEnZPqz7NTK6gWVZ iISjOh5qyBG8oQ+Y6RglJ05vgK6eCAoqor+JTJn1FGixkavd8bMQ1D6NY4qik+PaXgnS KPaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1736208239; x=1736813039; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=EsdX3K0L6RUajk4aeowkzYla6EH2ycdI9VpsUm/ueEE=; b=ujujQ9xWXhuiNocQE9xK8cpgQl+eGvFvATrANdgUByniWowaCflEAOSpAUjmoasbyI iDMbbfIwdZY1N+LhGo+1UsJx3pUyUeswdxyN34/QkGpsUMQMt/hfNyuESape4e9IpTNC IZ5Yn+dlILi5Q2prkEQ7YqGrRMBuzNVvYbKRkTqTb+DXyj0YWOoIxRes9Ct/U8tzLTxi YDgtw3ckYY0aGvUBGzz86rGbuG/08TpaI7YzIahWc8+YOsNZ7eRMTPzocwsO/QkDI986 Tbgf5zmy7BMV+schnF9lpm/YFovVbYlotlv53JIJ+hSO9MhFebmPZGPaMMUyq1QUfS9C rKHg== X-Gm-Message-State: AOJu0YwzAi7iiGJuU1AyXMvl4fZK1CZpJWh1GZOScTFN/8wecKQHU1X9 HAuh1TOlHb9TZBlrmSa/YDcuzUGpkRinI7puycrgsYiNyFQ0IGy03liY8NVjthbuq46Xzy1GGpM u X-Gm-Gg: ASbGncucBhCSc3e5cOlIFm5ZxCksQWB93MhLRE29UstEs6lS32sZh7eY6vYO6J5QXB+ uPLpMNM54GTbrdKjxpq2wHfrjprWg4NKo6ThN/PdLi+BuSl0Pr87TZErPOAwI2V9pR7mREuGwfy 37anfc3I8R62tiBcU8hHGYO9jYN5L9YzbMxavdFDuke0ByuukdBOvoHiKzPbo+N7CNXYC9aAg0F ChGnWmHp2GutiTMu5424jlsqhXo6QyhepNoZhOn5Jczl00HThUcihQI6k4IIg9kpFBz+8lOhb9a gLZMMqAlcHNfj7eYRMw3M47sZfcknbHnZUBiwSNYRclM X-Google-Smtp-Source: AGHT+IFjcy08ueMQthdN8WT7xWa+MvL9mh5Nnz9fWO29b2RIBwq+TvZ+nNviuLcDL7R+9H1KK37ATw== X-Received: by 2002:a05:6214:495:b0:6d4:25c4:e77d with SMTP id 6a1803df08f44-6dd2339fe2amr1069592226d6.34.1736208238692; Mon, 06 Jan 2025 16:03:58 -0800 (PST) Received: from gourry-fedora-PF4VCD3F.lan (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-6dd18137218sm174104476d6.57.2025.01.06.16.03.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 06 Jan 2025 16:03:58 -0800 (PST) From: Gregory Price To: linux-mm@kvack.org Cc: linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com, nehagholkar@meta.com, abhishekd@meta.com, david@redhat.com, nphamcs@gmail.com, gourry@gourry.net, akpm@linux-foundation.org, hannes@cmpxchg.org, kbusch@meta.com, ying.huang@linux.alibaba.com, feng.tang@intel.com, donettom@linux.ibm.com Subject: [PATCH v3 4/6] vmstat: add page-cache numa hints Date: Mon, 6 Jan 2025 19:03:44 -0500 Message-ID: <20250107000346.1338481-5-gourry@gourry.net> X-Mailer: git-send-email 2.47.1 In-Reply-To: <20250107000346.1338481-1-gourry@gourry.net> References: <20250107000346.1338481-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: C6C234000B X-Stat-Signature: muqn38c3g8hqoe5ty8r45hwre74cz1i7 X-HE-Tag: 1736208239-27876 X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Pg52EJaNyDxu57dAguU2fLhQPzqrE5Mz/YlDDubst5oeFx6vibkWTpIP19UstYsnkmJjXZhafllqAACHROUgMkXD3qvUtrJBpq9Yr3TCeal18tyaL0WvsXXzjiLSRFD66z80zdE2MVoCAwIJbyTl+pPtlsLPBVw7fNRhUCYlA7oXrg7oSmRhKWWWAFACvFcP+2SzuRVSDE9Dz6ps3J3x3bqMjA== 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: Count non-page-fault events as page-cache numa hints instead of fault hints in vmstat. Add a define to select the hint type to keep the code clean. Signed-off-by: Gregory Price --- include/linux/vm_event_item.h | 8 ++++++++ mm/memcontrol.c | 1 + mm/memory.c | 6 +++--- mm/vmstat.c | 2 ++ 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index f70d0958095c..c5abb0f7cca7 100644 --- a/include/linux/vm_event_item.h +++ b/include/linux/vm_event_item.h @@ -63,6 +63,8 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, NUMA_HUGE_PTE_UPDATES, NUMA_HINT_FAULTS, NUMA_HINT_FAULTS_LOCAL, + NUMA_HINT_PAGE_CACHE, + NUMA_HINT_PAGE_CACHE_LOCAL, NUMA_PAGE_MIGRATE, #endif #ifdef CONFIG_MIGRATION @@ -185,6 +187,12 @@ enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT, NR_VM_EVENT_ITEMS }; +#ifdef CONFIG_NUMA_BALANCING +#define NUMA_HINT_TYPE(vmf) (vmf ? NUMA_HINT_FAULTS : NUMA_HINT_PAGE_CACHE) +#define NUMA_HINT_TYPE_LOCAL(vmf) (vmf ? NUMA_HINT_FAULTS_LOCAL : \ + NUMA_HINT_PAGE_CACHE_LOCAL) +#endif + #ifndef CONFIG_TRANSPARENT_HUGEPAGE #define THP_FILE_ALLOC ({ BUILD_BUG(); 0; }) #define THP_FILE_FALLBACK ({ BUILD_BUG(); 0; }) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 46f8b372d212..865c9c64068e 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -460,6 +460,7 @@ static const unsigned int memcg_vm_event_stat[] = { NUMA_PAGE_MIGRATE, NUMA_PTE_UPDATES, NUMA_HINT_FAULTS, + NUMA_HINT_PAGE_CACHE, #endif }; diff --git a/mm/memory.c b/mm/memory.c index 24acac94399c..3f63cfd24296 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5576,10 +5576,10 @@ int numa_migrate_check(struct folio *folio, struct vm_fault *vmf, *last_cpupid = folio_last_cpupid(folio); #ifdef CONFIG_NUMA_BALANCING - count_vm_numa_event(NUMA_HINT_FAULTS); - count_memcg_folio_events(folio, NUMA_HINT_FAULTS, 1); + count_vm_numa_event(NUMA_HINT_TYPE(vmf)); + count_memcg_folio_events(folio, NUMA_HINT_TYPE(vmf), 1); if (folio_nid(folio) == numa_node_id()) { - count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); + count_vm_numa_event(NUMA_HINT_TYPE_LOCAL(vmf)); *flags |= TNF_FAULT_LOCAL; } #endif diff --git a/mm/vmstat.c b/mm/vmstat.c index 0889b75cef14..1b74d1faf089 100644 --- a/mm/vmstat.c +++ b/mm/vmstat.c @@ -1338,6 +1338,8 @@ const char * const vmstat_text[] = { "numa_huge_pte_updates", "numa_hint_faults", "numa_hint_faults_local", + "numa_hint_page_cache", + "numa_hint_page_cache_local", "numa_pages_migrated", #endif #ifdef CONFIG_MIGRATION