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 E8E49C5AD49 for ; Tue, 3 Jun 2025 15:01:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3026E6B049B; Tue, 3 Jun 2025 11:01:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 2B35B6B049C; Tue, 3 Jun 2025 11:01:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C9336B049D; Tue, 3 Jun 2025 11:01:14 -0400 (EDT) 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 F23C26B049B for ; Tue, 3 Jun 2025 11:01:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9F18CBE2CB for ; Tue, 3 Jun 2025 15:01:13 +0000 (UTC) X-FDA: 83514402426.19.FF2EC69 Received: from mail-qt1-f180.google.com (mail-qt1-f180.google.com [209.85.160.180]) by imf02.hostedemail.com (Postfix) with ESMTP id A975980004 for ; Tue, 3 Jun 2025 15:01:11 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SpBoxAmr; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1748962871; 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=M0248t4eZQdRB2vVgvMTgmO0dSdSCW91go28gBRUsBQ=; b=ZvvM/Z35MOU5aMm8CsdXY4ziSDgnBMo4EQWMNQ8BgMunqAEzK/gfm4NEbXHqYGoN0DTK01 g4lVrxuFGP4fYjNWARStQxRd9iJrM+j3OuZYGz3d+gQvpc26o3MeW4bF6PXeA22riOnjcI yh0jXttwmyB5PREjEvV6/DZXegYGCMs= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=SpBoxAmr; spf=pass (imf02.hostedemail.com: domain of surenb@google.com designates 209.85.160.180 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1748962871; a=rsa-sha256; cv=none; b=nnmj/b8WiHST8AxzDIgzkFBdAVKc7raha/kfoZ/diI2SoZSz18tX+Bh8GDmJ3ATAGhtuAN ByW9uaUtfOLXmcd9RdLuVLlIHZDiYYscLH1wR3mNZ/9jJW2om5oTckRE+mQnW9ed5HFw2+ L+1yfaNHYyHe0mcRmrEWldkOHjaPeVg= Received: by mail-qt1-f180.google.com with SMTP id d75a77b69052e-4a58197794eso227031cf.1 for ; Tue, 03 Jun 2025 08:01:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1748962871; x=1749567671; 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=M0248t4eZQdRB2vVgvMTgmO0dSdSCW91go28gBRUsBQ=; b=SpBoxAmr9C83tOUw+vUxx33Ag8525PYhFd74slC2Lg/Q09etA+Aycs+XKh3pU6Wapm WwNsKjbQk8zpcgvZqVNxmB470y74FHh1XNBWIuljgXSHqnhGpjK6T5Var1xfllBQIyEE 0zjTh7TD/I/qlS7LzSdE+TTdghBtJzsBoWhFa81RKm8icMAywKTwWNBkP8iq58W0p4Az tzt4QiRY/NT07AfW0Vdc9M2/IMtrbWpZl103xkuv1EfMr/fyl2WP7u4K/RMQB9pKlAw5 NNEc7O+bUPB23ASznauvG/hlnPyGUEUCRTlm//tbLx09P/umFSuvbx26uojo/BFzU7hJ 8JjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1748962871; x=1749567671; 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=M0248t4eZQdRB2vVgvMTgmO0dSdSCW91go28gBRUsBQ=; b=F2gNRu26IB+byd3TjrM1jgWCUHTW77YKfX/KwGwZRpZqwuYzFhOgzkhNqj8Pey21YS rTc04/MrCbqoDb17qGFLrrUeHQGjIDM/yUqxmZNigbSYnL+UIMhp77oB0PmOtJa6FwmH 9NIDDmGL3f+MUQKqttv5FS6j6ApJNs0/tG3cUShnc+7grxuB5Qc/a2LeshGa1+VXMbt7 Je93b45+tActNhdMFzgnsvlhjdvSbf2XfaKewevFLC1VGvj7gpciLbaNVbQoybGwslFt ZrlBB3IauWUptpUFdRTa7fmdFBsJGelnUBZ3TeFGUSgn84ZWDrrLx+KYk1PpnILY+tAj ZPyg== X-Forwarded-Encrypted: i=1; AJvYcCWOJsDHPLCPogGAM62j6ZBnH5Te8EvHuFOwDpHJi/2MSCOcpcWKZFyyztPbGXYmIlVgR93mcPIR4A==@kvack.org X-Gm-Message-State: AOJu0YwdW9KgWeLbHMpJr8nZU7plWPnbZ1BX2S/sMDzeYTyY6CSbShkR fDHiu0V5ONMy2ahptEG8uQhVs/Q8VCs6FsEiQC6n5lWGdvuBIt9RMkLYeFei/baJgQOXizfHDuZ LsZnz2YJ+0bgkzk1qhypW3TQBu2TD53n9hZud2yTI X-Gm-Gg: ASbGncsPWPwZeJ989CeBJwac+RngIr6xzFtlCzgO4mGfJ3GIsOZsHzya38mMYxYKVJu wjutjl9nJIstmrtjF0XEo9wbgkw8AfouNYqYlmAFrtXRRuJGJ4WegPcUjOno01Dh6yq27T4VrRP aukMEkxNAkYq6lTcMr49rAwOUFWiDCBx1zuyoKwNyNpQHWmW6w1tL5g4jAeX5MUE22w0HAw2IvI cfoIuKpp18= X-Google-Smtp-Source: AGHT+IGvTJXzVIX3b1h8cq/huhAknNXPo7wEw94JYYRoIXD8iY4WRuJECMNLb1tsCPBSXEEpyw+cO3Nczd/lhtvcZtE= X-Received: by 2002:ac8:6f1b:0:b0:48a:42fa:78fa with SMTP id d75a77b69052e-4a599ac441cmr4203691cf.2.1748962870261; Tue, 03 Jun 2025 08:01:10 -0700 (PDT) MIME-Version: 1.0 References: <20250530003944.2929392-1-cachen@purestorage.com> <5iiwnofmnx565g3xv3zdt35b7qkuwylzedkidnav72t24asswj@omjgyjnauulg> In-Reply-To: From: Suren Baghdasaryan Date: Tue, 3 Jun 2025 08:00:59 -0700 X-Gm-Features: AX0GCFsnSYbREsvH30dc9QT4IGNK6Q7bSOJRzpP5zs_svgNst3CBh6JARCzvxXI 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: rspam03 X-Rspamd-Queue-Id: A975980004 X-Stat-Signature: xuek6w9koiymmqrj984bsdsjdxk8txhb X-Rspam-User: X-HE-Tag: 1748962871-768054 X-HE-Meta: U2FsdGVkX1+feNpc1ut8SUGSvAMgmV/Q4eF7uZUE8HFSBG8AFy4mocJ4dKDttErV+zh+v0DmnU4LOzxCby2sf0g996zPzHs8tL9ekhhqO5P/khErfMIouUDIzaI0JOgUxV0/ADJMvDeSagF3xVnwVJPMDIl0i5M9eQgaDaCf3O1TgWC6HnslIRID6SjPRB01z/hHhijYpO9ZmvIiy40Krb6X9btFsaC+EEwvk0X2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qK603Aj5p0cmq+hfQ== 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 Mon, Jun 2, 2025 at 2:32=E2=80=AFPM Suren Baghdasaryan wrote: > > 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 r= cu_list") > > > > > > from branch mm-new of git://git.kernel.org/pub/scm/linux/kernel= /git/akpm/mm > > > > > > > > > > > > The patch adds per-NUMA alloc_tag stats. Bytes/calls in total a= nd per-NUMA > > > > > > nodes are displayed in a single row for each alloc_tag in /proc= /allocinfo. > > > > > > Also percpu allocation is marked and its stats is stored on NUM= A node 0. > > > > > > For example, the resulting file looks like below. > > > > > > > > > > > > percpu y total 8588 2147 numa0 8588 214= 7 numa1 0 0 kernel/irq/irqdesc.c:425 func:alloc_desc > > > > > > percpu n total 447232 1747 numa0 269568 105= 3 numa1 177664 694 lib/maple_tree.c:165 func:mt_alloc_bulk > > > > > > percpu n total 83200 325 numa0 30976 12= 1 numa1 52224 204 lib/maple_tree.c:160 func:mt_alloc_one > > > > > > ... > > > > > > percpu n total 364800 5700 numa0 109440 171= 0 numa1 255360 3990 drivers/net/ethernet/mellanox/mlx5/core/cmd.c= :1410 [mlx5_core] func:mlx5_alloc_cmd_msg > > > > > > percpu n total 1249280 39040 numa0 374784 1171= 2 numa1 874496 27328 drivers/net/ethernet/mellanox/mlx5/core/cmd.c= :1376 [mlx5_core] func:alloc_cmd_box > > > > > > > > > > Err, what is 'percpu y/n'? > > > > > > > > > > > > > Mark percpu allocation with 'percpu y/n' because for percpu allocat= ion > > > > 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 th= at > > > though, a single character should suffice (we already have a header t= hat > > > can explain what it is) - if you're growing the width we don't want t= o > > > overflow. > > > > > > > Does it have a header ? > > Yes. See print_allocinfo_header(). I was thinking if instead of changing /proc/allocinfo format to contain both total and per-node information we can keep it as is (containing only totals) while exposing per-node information inside new /sys/devices/system/node/node/allocinfo files. That seems cleaner to me. I'm also not a fan of "percpu y" tags as that requires the reader to know how many CPUs were in the system to make the calculation (you might get the allocinfo content from a system you have no access to and no additional information). Maybe we can have "per-cpu bytes" and "total bytes" columns instead? For per-cpu allocations these will be different, for all other allocations these two columns will contain the same number. > > > > > > > > > > > > > > > > > > > To save memory, we dynamically allocate per-NUMA node stats cou= nter once the > > > > > > system boots up and knows how many NUMA nodes available. percpu= allocators > > > > > > are used for memory allocation hence increase PERCPU_DYNAMIC_RE= SERVE. > > > > > > > > > > > > For in-kernel alloc_tags, pcpu_alloc_noprof() is called so the = memory for > > > > > > these counters are not accounted in profiling stats. > > > > > > > > > > > > For loadable modules, __alloc_percpu_gfp() is called and memory= is accounted. > > > > > > > > > > Intruiging, but I'd make it a kconfig option, AFAIK this would ma= inly be > > > > > of interest to people looking at optimizing allocations to make s= ure > > > > > they're on the right numa node? > > > > > > > > Yes, to help us know if there is an NUMA imbalance issue and make s= ome > > > > 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 yo= u > > > 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?