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 29541C5B549 for ; Mon, 2 Jun 2025 21:32:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BB3F86B034A; Mon, 2 Jun 2025 17:32:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B65086B034C; Mon, 2 Jun 2025 17:32:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7DA06B034D; Mon, 2 Jun 2025 17:32:23 -0400 (EDT) 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 897476B034A for ; Mon, 2 Jun 2025 17:32:23 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 03903141468 for ; Mon, 2 Jun 2025 21:32:22 +0000 (UTC) X-FDA: 83511759366.02.961368E Received: from mail-qt1-f176.google.com (mail-qt1-f176.google.com [209.85.160.176]) by imf07.hostedemail.com (Postfix) with ESMTP id 2754E40012 for ; Mon, 2 Jun 2025 21:32:20 +0000 (UTC) Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4Wd1rmXL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=surenb@google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748899941; 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=xHD8J5DY5u41AwhO44mZASlKH7PFOzpxZ6oLTqF8QrY=; b=pwoS4GfUpF4NPfM9B00AswCbvo0u6ZeBPOiPs7ua5B0y4niiMiArgdubuf66Vu1aP/cHJX IS+L+teBUN1zt0/O+yOmopl4v7zPTv6SVKfsFczCGkdYwngMmZiU4Np3QU6J3Ibkqbo2Hz KxhJcXfUMKYscgGkf4unzrOX54PqZ4w= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748899941; a=rsa-sha256; cv=none; b=ptL6ekGcaEmLXBBehnib322ygZUe5LNaFmAVyZla8DgKLPcqy3oPmw4RqFxlUSL7F2CkMk wzBwpgLMDpS2a7FmJst3w/y2TWnGgQSSrAOCupa098SwXqRtt30d61mBxjt34kQH3vw48k j+G2tapbdwYtb1PbiXr6FN4gW8Nw5p8= ARC-Authentication-Results: i=1; imf07.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=4Wd1rmXL; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf07.hostedemail.com: domain of surenb@google.com designates 209.85.160.176 as permitted sender) smtp.mailfrom=surenb@google.com Received: by mail-qt1-f176.google.com with SMTP id d75a77b69052e-47e9fea29easo57621cf.1 for ; Mon, 02 Jun 2025 14:32:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1748899940; x=1749504740; darn=kvack.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=xHD8J5DY5u41AwhO44mZASlKH7PFOzpxZ6oLTqF8QrY=; b=4Wd1rmXLSFavVtdnhSd3NExKUe3Ov0JCYa/3j6pueNpGMLiRrlf1NQWmgkkVl1zO63 KPbv9XEfnV4Mvy2QCA4W8LcS8S3spNp/cIFlp1bD2Y7jvKXfmWuek4UtO++kVbqjVLVp yRlII/OIB0kteVp2DB/UJG/m8vPnqWIQBUHcGR7UKiXyMjZcF1eBM7Kpnw3EkstMqkql FxH7vR6OBmK93HZeLYa6cIeNsiOg94AWvsFrSh5QwWgeTMKrpvZzdJ5by1t1RNQzW56G uCB9bQo0upVoeL1GkjuFxAtR0d4bkp1r22JjteIz+j/d1YXQ5WPrAdbs+mTPxT6TsUGC x/8A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748899940; x=1749504740; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=xHD8J5DY5u41AwhO44mZASlKH7PFOzpxZ6oLTqF8QrY=; b=dQ0q6v6JyP7x3DAOjDcZ5ZEkIPtb12K97aInTtfaRNrRg/EEbzxYC3O788lJJhpENV dU3RB4/mOOfevjKdYpeuKxOTneO8zjiltrmCl3CK283HUhuhkO6hPDLxWleLkKHZ7MBu f3++eJhDjc4GBp8Uidd74woCaGfvd3BnuQjpdDDnECxnuLN4HrVmrUxHqFZiwBl4fsgA rN6kOAoU33jAXyeoyiKSpmw9GAC58Ptn2i+339uZTePWlkq3Nr5Ylim6gkRFtsBmj5lt H0mjdokZnhid4dN51uVFEeOcQA2L+Z0T6TOzN/mhEatbv71FSXrZxIHLYvmoCblrryX1 LPhw== X-Forwarded-Encrypted: i=1; AJvYcCVoZsrslTYabJxwHdmfQJR0w70oetr9szECSCBzYQPwiX+rj07e2i5PdoOqOw15xz+0CifjWb0c/g==@kvack.org X-Gm-Message-State: AOJu0YzaUGxiUJwDVSctp8ErQBwRV++qW/6AcNtA0MeTRakmLM4bad9K P51grXeMsBlQUWvchLxfSd3aQfCmdK9G7F0esiUyfcKzfmQQkRBFAIQNXImujqqA5e2c8jvhUM6 q/9UUHcm182SiKrUygxuEMnv/F1CRvRJ64SVWlx2rHzBE2XCq5REtnaFfYu4= X-Gm-Gg: ASbGncvnAhYlV0UHMWYjANzweahy8NSeskxZkn7OZ1xOp1CM0MLgAspxwgO6/lFO0dg Y8pRTUaVFN2RYSJKUFknmVISsN6ZecrlYCya+iBnnu+XRxQ2pyzZ+5spS4U5iIwCWk4IrQfM/GJ eWFsHrD5B9vnskBC4nhLc80Z32qpECkacyPJJ/b6cm2g== X-Google-Smtp-Source: AGHT+IFs6ND0LHNhRsLg6e/V8RUupLbXL1nWTai7QepguPjAfXu3VISiHPVRPmbIylWFrHrwNpcBNOWgptVH0Z3hjCs= X-Received: by 2002:a05:622a:4d08:b0:494:9777:4bd with SMTP id d75a77b69052e-4a59adf8fd4mr267161cf.3.1748899939864; Mon, 02 Jun 2025 14:32:19 -0700 (PDT) MIME-Version: 1.0 References: <20250530003944.2929392-1-cachen@purestorage.com> <5iiwnofmnx565g3xv3zdt35b7qkuwylzedkidnav72t24asswj@omjgyjnauulg> In-Reply-To: From: Suren Baghdasaryan Date: Mon, 2 Jun 2025 14:32:08 -0700 X-Gm-Features: AX0GCFuVd-8Mg6G2O-DrsRuJbd1I7X4ItGF5HqHZe_xlC5eRgneLL4xWWokNhcU Message-ID: Subject: Re: [PATCH 0/1] alloc_tag: add per-numa node stats To: Casey Chen Cc: Kent Overstreet , linux-mm@kvack.org, yzhong@purestorage.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: 2754E40012 X-Stat-Signature: 4x574go6eoruxabt6jswp8934y7mm61c X-Rspam-User: X-HE-Tag: 1748899940-946189 X-HE-Meta: U2FsdGVkX1+QQpM56aIdB6fYq1k7EqhUyj2stQNPiW+2hgVUXAEN5QzoAf1hUWfNpnUwDBT+cjDxiuuS1/tlMN5lYLZwTGrgcYG89ruJ74vwIqtjWR0BXXlQvq36LiIYsy0HgHxuwqkFDYTp2PwCFAu4OvVpx7tS9Xs946tRt0vwWELv7NsJ3Dnyswf5sdwFxRNe/QFSI4Ece7pxicuB6WcJKA115QmgoUBgUTzLVawbT/jJbUPbUbQFv+q5QJqPa5TW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: 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 Mon, Jun 2, 2025 at 1:48=E2=80=AFPM Casey Chen = wrote: > > On Fri, May 30, 2025 at 5:05=E2=80=AFPM Kent Overstreet > wrote: > > > > On Fri, May 30, 2025 at 02:45:57PM -0700, Casey Chen wrote: > > > On Thu, May 29, 2025 at 6:11=E2=80=AFPM Kent Overstreet > > > wrote: > > > > > > > > On Thu, May 29, 2025 at 06:39:43PM -0600, Casey Chen wrote: > > > > > The patch is based 4aab42ee1e4e ("mm/zblock: make active_list rcu= _list") > > > > > from branch mm-new of git://git.kernel.org/pub/scm/linux/kernel/g= it/akpm/mm > > > > > > > > > > The patch adds per-NUMA alloc_tag stats. Bytes/calls in total and= per-NUMA > > > > > nodes are displayed in a single row for each alloc_tag in /proc/a= llocinfo. > > > > > Also percpu allocation is marked and its stats is stored on NUMA = node 0. > > > > > For example, the resulting file looks like below. > > > > > > > > > > percpu y total 8588 2147 numa0 8588 2147 = numa1 0 0 kernel/irq/irqdesc.c:425 func:alloc_desc > > > > > percpu n total 447232 1747 numa0 269568 1053 = numa1 177664 694 lib/maple_tree.c:165 func:mt_alloc_bulk > > > > > percpu n total 83200 325 numa0 30976 121 = numa1 52224 204 lib/maple_tree.c:160 func:mt_alloc_one > > > > > ... > > > > > percpu n total 364800 5700 numa0 109440 1710 = numa1 255360 3990 drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1= 410 [mlx5_core] func:mlx5_alloc_cmd_msg > > > > > percpu n total 1249280 39040 numa0 374784 11712 = numa1 874496 27328 drivers/net/ethernet/mellanox/mlx5/core/cmd.c:1= 376 [mlx5_core] func:alloc_cmd_box > > > > > > > > Err, what is 'percpu y/n'? > > > > > > > > > > Mark percpu allocation with 'percpu y/n' because for percpu allocatio= n > > > stats, 'bytes' is per-cpu, we have to multiply it by the number of > > > CPUs to get the total bytes. Mark it so we know the exact amount of > > > memory used. Any /proc/allocinfo parser can understand it and make > > > correct calculations. > > > > Ok, just wanted to be sure it wasn't something else. Let's shorten that > > though, a single character should suffice (we already have a header tha= t > > can explain what it is) - if you're growing the width we don't want to > > overflow. > > > > Does it have a header ? Yes. See print_allocinfo_header(). > > > > > > > > > > > > > > To save memory, we dynamically allocate per-NUMA node stats count= er once the > > > > > system boots up and knows how many NUMA nodes available. percpu a= llocators > > > > > are used for memory allocation hence increase PERCPU_DYNAMIC_RESE= RVE. > > > > > > > > > > For in-kernel alloc_tags, pcpu_alloc_noprof() is called so the me= mory for > > > > > these counters are not accounted in profiling stats. > > > > > > > > > > For loadable modules, __alloc_percpu_gfp() is called and memory i= s accounted. > > > > > > > > Intruiging, but I'd make it a kconfig option, AFAIK this would main= ly be > > > > of interest to people looking at optimizing allocations to make sur= e > > > > they're on the right numa node? > > > > > > Yes, to help us know if there is an NUMA imbalance issue and make som= e > > > optimizations. I can make it a kconfig. Does anybody else have any > > > opinion about this feature ? Thanks! > > > > I would like to see some other opinions from potential users, have you > > been circulating it? > > We have been using it internally for a while. I don't know who the > potential users are and how to reach them so I am sharing it here to > collect opinions from others. Should definitely have a separate Kconfig option. Have you measured the memory and performance overhead of this change?