From patchwork Tue Dec 10 21:37:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13902105 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 3143EE77180 for ; Tue, 10 Dec 2024 21:38:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D35DF8D0019; Tue, 10 Dec 2024 16:38:19 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CBB608D0013; Tue, 10 Dec 2024 16:38:19 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0F5B8D0019; Tue, 10 Dec 2024 16:38:19 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 91BDE8D0013 for ; Tue, 10 Dec 2024 16:38:19 -0500 (EST) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 465941605A6 for ; Tue, 10 Dec 2024 21:38:19 +0000 (UTC) X-FDA: 82880362404.10.F156144 Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf30.hostedemail.com (Postfix) with ESMTP id ED2E38000D for ; Tue, 10 Dec 2024 21:37:34 +0000 (UTC) Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b="vBSx1/iA"; spf=pass (imf30.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.176 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1733866674; 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=3Jq0f3dJTpHJXJDokS6aQHyPKu/LFNDC+TZCLMRgrQ0=; b=2Y2Hqa16R0W+sG85KlylaBOW670IQkS1wZMS+R31eLkyMYNfbJrV3Tz+flghVteCHlJRkC OwBde8Gniu/4bFd/gFAnz98TEf9xSZztqZGdtBFvgSQS9IvFeNcOFOxBfhwd6n7bLXP4s8 7KDE696IMH7tvP5CBF4VhJ36X/zBAZM= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1733866674; a=rsa-sha256; cv=none; b=ySYxKCXzSKovy3aKU3g2I7aWM40LLDEEHMJSx0Q0lFR/KzlLUoAEMdpiO5B+GlysjUYTKC oerfUO8KzJS5CkfWE6OFTQXGkqjd4c0JKDkvAUeDQ/Qkj5qImD+HmSrTGRmPaD74Nuc0oa pG2/EmHGw8at7lD7gEPages2n/Jl1kY= ARC-Authentication-Results: i=1; imf30.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b="vBSx1/iA"; spf=pass (imf30.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.176 as permitted sender) smtp.mailfrom=gourry@gourry.net; dmarc=none Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-46761d91f7aso25975701cf.1 for ; Tue, 10 Dec 2024 13:38:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1733866696; x=1734471496; 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=3Jq0f3dJTpHJXJDokS6aQHyPKu/LFNDC+TZCLMRgrQ0=; b=vBSx1/iACy0TeuUBs9Un2DpkChyr3AAu41rJ5cADld2sdKpBzF/HQ2XPPL3c8/FELq f1YlO2R0bA8KVWll0ntX4mRlX2cS7DICeQAG4GifgFGuYm/xh3vQBzQq5rojXqLWqwXx cbWtdrXQLsP/aanVTXY4FvGBKNU5PqKiSSKKXLZ69b9ly+tfSGPJYfGy9s3QIrPs0mQL jl20shk5bUeLJsUUYMxcRWNUnUNAyoPUa2AW89DRJ4o/e5qAh5FMJjtBMeiF0IIHpZ3E wjgOeQIIf6TD/WeJIkb+SIOt5WrfUOZcX+f5QHc0UBCZJRm1Q7lSDD+X07nUVuuknumb cL6w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1733866696; x=1734471496; 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=3Jq0f3dJTpHJXJDokS6aQHyPKu/LFNDC+TZCLMRgrQ0=; b=J67aCah+eZrjLiux8M9S7H4i4Yr5KNt2rj545GdxSdse+c+7HPtAQQpizpitkTsIxr iYbjLmr+O0unSa4Srhvth7puOY0Tx/oQMCJA8j19OZWIzUM9/Aisct390V39vxl99qNr BrBf9egSh4eSldyIqLkA973l/DOEFfB0PV4LjGxb8tVIvPvt7Ltnh0a3kXhngSXLbQeW dDkSHuMtG7jmikGLi+hG7Pyy1Xg2a58TtyAJiDyDY9prwmMgqv3qLORPC2yGVhsjwUMl cn+5xGoEtmspr/tJUd0nHVtKGRVWxYKcTxVSA5/z+Da/WAheQXnreKwx20fjHq52+GcK 0Adg== X-Gm-Message-State: AOJu0Yxh3s0kC4Eys9nhtMRpglMb8JQzLaA1xY18YXLwSETq3G/WNRXo nxFZ/LM6R6z8rD/w6G9Sx1UIhS7iRewHNWfhPwoP/55PrInSrLU+lGX3F08sMJBl99eMOi1czMT H X-Gm-Gg: ASbGncv1K6UE3r0Ux4/QjhCz817QTqtlVPgvdu20UZbvHyNF4TAUfYK6LX25DR88CFK DEkcEJl85udFys2PLC4aFu0vbYlIXB1YgO/PK5b3fvGY50P28ZuXgcfHcbnf1jorO8ZgKOO3V/U 1e+wuk1wH+CQXiEpsz7QnGj5QBB8Dsu/4EUsRlMhn0qxG1Zpt1mBGOUKwdKd/7UnXJMQKCUPz2D eVy8fx/esiwHpY9UNBoCWhCdlHR+4ZpWnhV5JYFzTMoek+SgU265O7qShDBPcsu2QK31y45r44N QBmKVS+p94GKSSiBe0BJNUPKbWvHrEgOMyJFolY= X-Google-Smtp-Source: AGHT+IHxInG7lq5H3xVJww7rlvFoTxqlg+CA0d/WG83+KpCA77jzrX+fsIGQc0RjdUSsv/+VccPkKg== X-Received: by 2002:a05:622a:4d45:b0:466:a584:69f8 with SMTP id d75a77b69052e-467893bcc14mr7050891cf.43.1733866696431; Tue, 10 Dec 2024 13:38:16 -0800 (PST) Received: from PC2K9PVX.TheFacebook.com (pool-173-79-56-208.washdc.fios.verizon.net. [173.79.56.208]) by smtp.gmail.com with ESMTPSA id d75a77b69052e-467296f61f6sm65978991cf.43.2024.12.10.13.38.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Dec 2024 13:38:16 -0800 (PST) From: Gregory Price To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, nehagholkar@meta.com, abhishekd@meta.com, kernel-team@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 Subject: [RFC v2 PATCH 4/5] vmstat: add page-cache numa hints Date: Tue, 10 Dec 2024 16:37:43 -0500 Message-ID: <20241210213744.2968-5-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241210213744.2968-1-gourry@gourry.net> References: <20241210213744.2968-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspamd-Queue-Id: ED2E38000D X-Rspam-User: X-Rspamd-Server: rspam07 X-Stat-Signature: dcfhk6fdphe3knk3fmwddwr9xe9qtn3h X-HE-Tag: 1733866654-825547 X-HE-Meta: U2FsdGVkX1/GpwCM5fYZGlDcugkZ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varyNdvdytE3u/EXuIaZAU+ZOzZnLNZm+drM40jECPbxyi6pSkEALXXueOLdjM6JrTxuLTY24rhILIZxjR4YeguN9UshdxZKtKb3KwxovMY0TgVZbQxtyEO1oEHOjW9+UUIEp64avBYAr0UmjAd5FUF1KgHMRXYmZANkPksFWmmeI11dDqDZBVmgQ== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000021, 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/memory.c | 6 +++--- mm/vmstat.c | 2 ++ 3 files changed, 13 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/memory.c b/mm/memory.c index af7ba56a4e1e..620e2045af7b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5578,10 +5578,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 4d016314a56c..bcd9be11e957 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