From mboxrd@z Thu Jan 1 00:00:00 1970 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 42B06CFA46A for ; Wed, 23 Oct 2024 20:41:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CE4E46B00B6; Wed, 23 Oct 2024 16:41:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C93DB6B00B7; Wed, 23 Oct 2024 16:41:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B35496B00B8; Wed, 23 Oct 2024 16:41:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 928DE6B00B6 for ; Wed, 23 Oct 2024 16:41:25 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 17ECC160E94 for ; Wed, 23 Oct 2024 20:41:05 +0000 (UTC) X-FDA: 82706036154.20.9089917 Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf09.hostedemail.com (Postfix) with ESMTP id 17B29140004 for ; Wed, 23 Oct 2024 20:41:10 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ORrYL8Xb; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1729716045; a=rsa-sha256; cv=none; b=OGz5yGDpsM5VLA0xem782Ocey73rzxZHGub0RpllHNBGoWrEHYLCsGjxzOTX4ToaLx9fDK r88f7I92C6aEGAmcP9IXF5QXxpWO9bKnLtRaZvGyE43jT45OQUEmERLlGdm5V791+UMzIG GjxLc/nutst9pa6OaM3tMKawf7+pN5M= ARC-Authentication-Results: i=1; imf09.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=ORrYL8Xb; dmarc=none; spf=pass (imf09.hostedemail.com: domain of akpm@linux-foundation.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729716045; 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-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=G2xdXXadpUwRwyQECXaUGGY63mLTY4/q6rr1YiSOlSU=; b=Po2N5uvtkBdQeqB4waoUoV7SfS8YlSnl9E8nzlPGjzSHcUSwvKtZs+Ion+Y3g7QxzVa118 /H+gATCbePHR6XIrfgAaBUl4eTYQsmVKmk/y0AwgUKTlYGQKDkMnaipQokqZ/YzM3aL9mk 5bEsjUWl0RcnESuD0DAFGu2sv5oSA2c= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 8B7FFA406ED; Wed, 23 Oct 2024 20:41:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 30B2DC4CEC6; Wed, 23 Oct 2024 20:41:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1729716082; bh=3JRZMNUNQedJCcz0d6X+3HKipkE+z+AGyw055WODxJo=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ORrYL8Xb0+DKOh5QHCipmhyIA+N35jK8Ld70+mse2XqSVBdlihm+zw0iQuBbUVHN0 GhfZn4Hkjmnd30A+eudjOKMyRhOBzGbwiXKijtQLhn6g7cxaNhG8Z1Tr7Br2IoOLmF 2FTBA3TQbyxFj7DXMSk+3gtaIMZGzdCcmiFVlOQY= Date: Wed, 23 Oct 2024 13:41:21 -0700 From: Andrew Morton To: Michal Hocko Cc: Dongjoo Seo , linux-mm@kvack.org, linux-kernel@vger.kernel.org, dave@stgolabs.net, dan.j.williams@intel.com, nifan@outlook.com, a.manzanares@samsung.com Subject: Re: [PATCH] mm/page_alloc: fix NUMA stats update for cpu-less nodes Message-Id: <20241023134121.68d4af59e2d9cc3e78a34cc8@linux-foundation.org> In-Reply-To: References: <20241023175037.9125-1-dongjoo.linux.dev@gmail.com> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspam-User: X-Stat-Signature: npd1ktwcrfou7zjw7rkm5c5tg31wpsmw X-Rspamd-Queue-Id: 17B29140004 X-Rspamd-Server: rspam02 X-HE-Tag: 1729716070-539280 X-HE-Meta: U2FsdGVkX1+KkAUG5Ptrg9Mm20q9RynfbSD8jdIBIyUu2bMUqzdBTi04RwFUI1zSPIlRbFmd3BLorHyQYnjJjPdt+PYc6GH87milkOcMO2HkY448pJGtxSAzBm/uFtidgH4KueOfyZKRcBOuXUqC/wbX7N5ULkL/UC7Hp4ijhoSM+eQospfobl1YC6C4vSl4hDcReK0gWHrTucoQp+p8U/pFCKeilu+7/kxlpBLg6KIGvFFkAM8SJhP1HZ3gH8OPPfkKM0FEYQMpz6ezTiWqv0aRUPZl4MmP8K274BPrx//uJL9CkMCjb2Ax4Cfq9ouabVxK9/jXMeFRplB9Oa8AwsilfqGnaFEEJXqqh6RIwz5MivAVX4+Xtw90YjSLIREC5CNEtp3gSNaDKlVgFUCKT8HOJTF7Pu02sj8o1GYx6sLZGrG9GIHKT2MoceQ1I7H2G+2XQoJU/w5VHXLumtz8OC1kKEaFiB3iJcqWO6IwLdbITmvdZj9s9XBWZWd36Xa5jqJw8Nw2W3oYPMHR0FS7uf9howcUEd1jezodD+wDbLmzOB1JX0DuwmRe9UlXCi1D2bp5mmUiOsRhe3vdyvdB5QEe40xL5TFGml8qnOOIS2+HiHebR78G4ybxds8As8XOZkUG+HNF17Ze60EIsopq9bmSZXAmk74BiZkzoShD9GbL4F7HCOSdr4qp3UOXwSZmdptRi3WcnZoFJuVyCxJ4SQx+Pu1hgcMuq/4c73O6BeJcA1K+icUtnLMPzmBIIEVlKUX6suTwroW8HtHNuzWIp3zAr9l0nrsj7e0BqMsVCqkcvOkeewf5ShctNmjgdYYA8BTcwycrI7rV1yEB9hK7awuHzRdlbssK87YeAh6yvy28YmdVR3kK2ZMuh3XzpF6Nx7KsKQiv41LN8yk+X8yF4lUFZ756p4Ve5PDej7EMnLyBqBGmAbFgodiFxkb4wO9nQRNBQ/ur/dV+HH0CdE+ GXCbm0Le WU1VkwJNALUSrPSDQUgiaPJ2viHevzR8VK1bbKyUiBjhRLzREmyec5Q5teAmXak6M+zHRzoa81PuRixwgZS9WXClARmHY3ZQinSpd6NoxGZageLkzgAOrfC69Ctwqc5Ki5zYJTw+FzHzVguydFPEh18b1DyKT7g1CkDGCBrszrWW/10AIVxsB1VkoYbuQn0AbwMK6tib8qAUZh1x4UOzQ519fS/mZ6/l9XOfPuoGICn12vEQN2pHVRwgSn6zIGQVyUooyNKTeMtiS6eNLxrs+tIx3NqIHsPoETxyXIUoFukqy/3++w9Fnie7Gor5C+l0HRLVvPz0VD1fSyzUhkcunet4G+XqMn/ePWOanaZHA10jfUsTrdSccMZoo2ofeTFbHlZFAeNmkIraWIRvN8rh88ZGLC8U5vbm7rLCDDyXoBpmpMq8= 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: On Wed, 23 Oct 2024 20:03:24 +0200 Michal Hocko wrote: > On Wed 23-10-24 10:50:37, Dongjoo Seo wrote: > > This patch corrects this issue by: > > What is this issue? Please describe the problem first, Actually, relocating the author's second-last paragraph to top-of-changelog produced a decent result ;) > ideally describe > the NUMA topology, workload and what kind of misaccounting happens > (expected values vs. really reported values). I think the changelog covered this adequately? So with these changelog alterations I've queued this for 6.12-rcX with a cc:stable. As far as I can tell this has been there since 2018. : In the case of memoryless node, when a process prefers a node with no : memory(e.g., because it is running on a CPU local to that node), the : kernel treats a nearby node with memory as the preferred node. As a : result, such allocations do not increment the numa_foreign counter on the : memoryless node, leading to skewed NUMA_HIT, NUMA_MISS, and NUMA_FOREIGN : stats for the nearest node. : : This patch corrects this issue by: : 1. Checking if the zone or preferred zone is CPU-less before updating : the NUMA stats. : 2. Ensuring NUMA_HIT is only updated if the zone is not CPU-less. : 3. Ensuring NUMA_FOREIGN is only updated if the preferred zone is not : CPU-less. : : Example Before and After Patch: : - Before Patch: : node0 node1 node2 : numa_hit 86333181 114338269 5108 : numa_miss 5199455 0 56844591 : numa_foreign 32281033 29763013 0 : interleave_hit 91 91 0 : local_node 86326417 114288458 0 : other_node 5206219 49768 56849702 : : - After Patch: : node0 node1 node2 : numa_hit 2523058 9225528 0 : numa_miss 150213 10226 21495942 : numa_foreign 17144215 4501270 0 : interleave_hit 91 94 0 : local_node 2493918 9208226 0 : other_node 179351 27528 21495942 : : Similarly, in the context of cpuless nodes, this patch ensures that NUMA : statistics are accurately updated by adding checks to prevent the : miscounting of memory allocations when the involved nodes have no CPUs. : This ensures more precise tracking of memory access patterns accross all : nodes, regardless of whether they have CPUs or not, improving the overall : reliability of NUMA stat. The reason is that page allocation from : dev_dax, cpuset, memcg .. comes with preferred allocating zone in cpuless : node and its hard to track the zone info for miss information. :