From patchwork Wed Nov 27 08:22:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gregory Price X-Patchwork-Id: 13887194 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 93EB5D6ACF4 for ; Wed, 27 Nov 2024 16:28:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BF2106B0092; Wed, 27 Nov 2024 11:28:50 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id BA3866B0093; Wed, 27 Nov 2024 11:28:50 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A1C856B0095; Wed, 27 Nov 2024 11:28:50 -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 821D86B0092 for ; Wed, 27 Nov 2024 11:28:50 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 0F9E5161889 for ; Wed, 27 Nov 2024 16:28:50 +0000 (UTC) X-FDA: 82832408694.04.6E073C4 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by imf13.hostedemail.com (Postfix) with ESMTP id 7BD6B20019 for ; Wed, 27 Nov 2024 16:28:39 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=GTv2b9s7; dmarc=none; spf=pass (imf13.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.177 as permitted sender) smtp.mailfrom=gourry@gourry.net ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1732724922; a=rsa-sha256; cv=none; b=bjZO+ZOxBZW6wJXmmuxNlTqXwtkJ6M13XzgqC2e0NXogC7mN0SLchUIs2H9QeZWry6AiJ+ xGM544Q9ns6QtYG/+Qn4Ebc1I47ZS8LZIp4uFFhz9Qp8CYWMCQHg6aoFIz+L+YRGyqtCDs p9Bd/7fCGIfbhErDOjnx9NcEVUM7Zx8= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=pass header.d=gourry.net header.s=google header.b=GTv2b9s7; dmarc=none; spf=pass (imf13.hostedemail.com: domain of gourry@gourry.net designates 209.85.160.177 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=1732724922; 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=7qVD2IQ6TUVnIPl8KOFrC6kDkrJSATgnAz7c/+Cb6G4=; b=lSC4LeLcWPEDbodF4mnXzIfbr4NSeIYwss1zE7hYoJ8zqvpRnLRRnkScNxf48aH8Sx04G8 ZE1BlFUHJnroEe0rNA1Ev+7m/CjNH6p6j7a3K9pB72gJwVbUoRgcbR6jaHSKXpEFZXJp+A zyXyBuYLW89A0Y5Vh1EbrZsuB1x3b7E= Received: by mail-qt1-f177.google.com with SMTP id d75a77b69052e-46375ac25fbso50845861cf.0 for ; Wed, 27 Nov 2024 08:28:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gourry.net; s=google; t=1732724927; x=1733329727; 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=7qVD2IQ6TUVnIPl8KOFrC6kDkrJSATgnAz7c/+Cb6G4=; b=GTv2b9s7Y3ERlqz/98zhdUBDNEPpX72csiPwZClV8KCrGsMoCAVnVQkHFB9MzAlgn4 uN3bx7/WeqmWVmx+OvFG289H5W923ZxSElyGaLZKfSEmcrb2ShTt7sfmOu8jGVcrRGkJ ZHxX1aqS+G36OXcrLoyC28GggnQbSItHvU8/hVcmZW/+CD0TCgUu7sBCJyWC11UQa85X qYy6PFeaZ89827OF4qEHdVRJb/GepVsga4c5kUpRTLrmEKIlKw+ESIFoiBjb72X41dpp OlHafZgf87/yYvkKBcv8PNpL0ELf8OZyDs8T4iiSkHY0BFfcGmmt6abbrqjjqV/rh7ny Qn/g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732724927; x=1733329727; 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=7qVD2IQ6TUVnIPl8KOFrC6kDkrJSATgnAz7c/+Cb6G4=; b=HiO4JnDsLo+534SHRBhbpVJXJOlck2asmqIsLq8JP1apC3+iNUQ/FoJR8yxLHLyRF0 9Onz8/LRB8ITLv/Ptu7uJLo0p+/itx2zE5xkgOmv8JQfqvqHNXqXPwBv4dwi/Zv6+Grd nph4WC/F+HpKrg7/5fv1htCE+on3Y6I8RNpq/HcTewJjv2rnY1bQkDJvITY1l3gf8uLI 9M5RjS5daJKWLyhfTdXP06Plrm/vsVtaj7GMbSiDrMXjRQqQL+4ceB3FTYGb/AAhZNFn qYLJIiLPDM+4g5BaWCaNUxDdcxE3XJFbt07Rq+DPrhXVsexsBbB41AdJpUh3fD1cpDWV MiXA== X-Gm-Message-State: AOJu0Yw86W/8i/6ssu+lovQh8xqyTEtkM/RY7FXHrJsHY9SI3pcGWMtp evXZewxlTlPlWL2fo3wBrXA43gLyxgxKxFmMIY2sm0wjETWbcSEZcqgJGiDRPxBNhSNX8SStJbI p X-Gm-Gg: ASbGncsgP+lnP24vgK/xezYBGNIC4tTvkDMvTHQRVUBNc3jymossoarCk2j/oLY1Lsr 3rhkuJXuVps5Y3AmB+2h1oZVsZ0BvfVLP7z7TsitRHV8cb+oRLV24kjLyG9r8yO3Eg7OAMZ1Wft 1dtg0PWw0NBELmpLrejhQmYkQbd2DkexxV3juT/uSkm6AIIKwyAzgSxDo8/u2Wu8A/HA7R65z9v FQy11jyTY61a88rw1fpV9qgiEnVtpP5k3cZ+/11y605MWCsuKIbsbE0Dl4QWYruq2r60aIkgmP+ m4TEbDjSTfTqmmdCO4lRUZ1sm3KMXNPnECk= X-Google-Smtp-Source: AGHT+IG/ToEOt1Gt6Ry1TUTbihCqZ0qO6hIYx2iJN602ReOwj0JgnK+caF+0walmHaDLqNcTTiZU1A== X-Received: by 2002:ac8:5811:0:b0:460:e9d3:e989 with SMTP id d75a77b69052e-466b34d31c1mr44603091cf.8.1732724927143; Wed, 27 Nov 2024 08:28:47 -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-466871721c2sm45002921cf.17.2024.11.27.08.28.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Nov 2024 08:28:46 -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, ying.huang@intel.com, nphamcs@gmail.com, gourry@gourry.net, akpm@linux-foundation.org, hannes@cmpxchg.org, feng.tang@intel.com, kbusch@meta.com Subject: [PATCH 3/4] vmstat: add page-cache numa hints Date: Wed, 27 Nov 2024 03:22:00 -0500 Message-ID: <20241127082201.1276-4-gourry@gourry.net> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241127082201.1276-1-gourry@gourry.net> References: <20241127082201.1276-1-gourry@gourry.net> MIME-Version: 1.0 X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 7BD6B20019 X-Stat-Signature: e5rhnbdomy8k8sqeet1mn1mzwq3647ma X-Rspam-User: X-HE-Tag: 1732724919-594327 X-HE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U2sh1s1gp7k+xmN09KB3YEWB3E8otPG7RY4uBe1sT9tGUDlDk6YHsSA1kPTOj+6TlNs22eLQGodGhezpEacAA6L1yZofl8SpMXfukUdpmxz54L1sxt3ZTivT80snYovZC8GwAMtgQZzKYkJulAJbVs5495OO8wkZY8onkB/3mtN5JB9zttt6Iy4h1FwoRJtiZBOtAILJuGHEgr5xN8fOt7xvtRPp5RFuw== 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. Signed-off-by: Gregory Price --- include/linux/vm_event_item.h | 2 ++ mm/memory.c | 15 ++++++++++----- mm/vmstat.c | 2 ++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/include/linux/vm_event_item.h b/include/linux/vm_event_item.h index f70d0958095c..9fee15d9ba48 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 diff --git a/mm/memory.c b/mm/memory.c index a373b6ad0b34..35b72a1cfbd5 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -5507,11 +5507,16 @@ 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); - if (folio_nid(folio) == numa_node_id()) { - count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); - *flags |= TNF_FAULT_LOCAL; + if (vmf) { + count_vm_numa_event(NUMA_HINT_FAULTS); + count_memcg_folio_events(folio, NUMA_HINT_FAULTS, 1); + if (folio_nid(folio) == numa_node_id()) { + count_vm_numa_event(NUMA_HINT_FAULTS_LOCAL); + *flags |= TNF_FAULT_LOCAL; + } + } else { + count_vm_numa_event(NUMA_HINT_PAGE_CACHE); + count_memcg_folio_events(folio, NUMA_HINT_PAGE_CACHE, 1); } #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