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 031A1C5B552 for ; Tue, 10 Jun 2025 16:24:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 967146B0092; Tue, 10 Jun 2025 12:24:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 93E746B0093; Tue, 10 Jun 2025 12:24:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 87BEA6B0095; Tue, 10 Jun 2025 12:24:39 -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 67F166B0092 for ; Tue, 10 Jun 2025 12:24:39 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 96381E18CE for ; Tue, 10 Jun 2025 16:24:38 +0000 (UTC) X-FDA: 83540014236.08.3AC7B90 Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) by imf20.hostedemail.com (Postfix) with ESMTP id 936851C000D for ; Tue, 10 Jun 2025 16:24:36 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qw7D7Vg9; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1749572677; 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=SuFb2et/mtRp7CBWSKuOANqFw+DLi3y5Z+GUeprREfY=; b=lbEUD3EvbidFBvYocwTJHlXLdo+8+or0EpPIUK3VDZLzzUZcHgeRHkpZNNWhACmhBHkHnd YkHEe7xaU9VgLXbtpekvtaYaH5aEAJctWZn7q0bUbB9kKPKicp5hDF5z34ewk1ZM7xhctx PMtDC6O6ia4uSzNTBg8uuN8d2EFAwWE= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=qw7D7Vg9; spf=pass (imf20.hostedemail.com: domain of shakeel.butt@linux.dev designates 91.218.175.181 as permitted sender) smtp.mailfrom=shakeel.butt@linux.dev; dmarc=pass (policy=none) header.from=linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1749572677; a=rsa-sha256; cv=none; b=WtlE8jrP4kJ1iczdDo12XFcPe3I13irpS29UXuUchBxKC+AFtimEzKwSdVrrzGe9EDU2VH LBaQ3D++HSZA7y9EfaXJ8hl9uDSdJUTzcWKuGFnrKW8bv0vBTo0ytj4q1wd8tqp2tt6p7u tMj4Wdnazjd8ZqG1WhnyVXi3cm1USJY= Date: Tue, 10 Jun 2025 09:24:26 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1749572674; h=from:from: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; bh=SuFb2et/mtRp7CBWSKuOANqFw+DLi3y5Z+GUeprREfY=; b=qw7D7Vg9FCBzL5DNdgf0SAddZHwqcdlH2ysFX5KYsKI1uXiuuQQhyhnzAF18T/aTf9Gs/r uHFsceSBut0aizru8xF5IcR3HOwa0GCbzz6z02T3zh2RO0aLkaL3OiMTxOpOXFNXo0SXVC wnpJ5SDuV/NxPK1lPUQitXLaZeRJfus= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Shakeel Butt To: Michal =?utf-8?Q?Koutn=C3=BD?= Cc: Tejun Heo , Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Muchun Song , Vlastimil Babka , Alexei Starovoitov , Sebastian Andrzej Siewior , Harry Yoo , Yosry Ahmed , bpf@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, Meta kernel team Subject: Re: [PATCH 0/3] cgroup: nmi safe css_rstat_updated Message-ID: <7u4lmf3yd5jlit7qyudbeuhpxvvjrmfq7arfvsxpkqwahm4326@4fbxtdpikosd> References: <20250609225611.3967338-1-shakeel.butt@linux.dev> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 936851C000D X-Stat-Signature: p75m3kztxjkja6nrbc9drug7rc66954f X-Rspam-User: X-HE-Tag: 1749572676-325530 X-HE-Meta: U2FsdGVkX1/k1Edh1XM1CpyLud4VU3E4HV+NE2CkMwvGL/5G7TGSN+kLUfJKLlWjR0tUgWonWemY0NPpfaF5l08c5o4eXYvMBrRxO8tnVAJbgjQoLHdSp9vrrpkiNTXlgSDnrp0sqBDQv8qGTY9Vs7Dc36S23+hTeyS0n4bdP1/5WJfOm+9+HaVU5j8n88wxfrKt/WqsvduGKTKXH7vmG9Qre7uJuAICuSyMrU0/UMtBa7ZUBq5HjGQano/Sjqu5IENawYPbxFDTD6JtWYNL1gbab0t+HzTh0Bw753fr+LOU/iqbkPJPpJe7PiLlSO9EnurhMkELmxZx41g1NByRwldWeMdAZRYxsKsLS0AE1OP9S8A0UTk8xK6gJffFFLUL14FB4LoTHXuB44owEGCcf3ZuHsLxKdDJV7x/l1RbJ7ZN4xZXcRfjPW25W19d7QZb97nfDj1AA8HMJy5EocDiQO+t1IJkIjhCaB4KgsQgl8ld+f5XyKVu6q96dDytg1+M7jhE+pIKzLR5c+p+5Mcw0ybj7H4l0WnziptVm8Oac/0fw/4U1Jm7FfhNii1d3ZStibrLAXuhnL0InWUFNP2eUV8M0Dz1pizYOQlA+XMG8O/RAeWk1EOJNvRIPlLg2zeGc1ZHe3XQnlRaZ7yMhJKX+T41feBAdg/HS2gTclF20WrKgRlXzF67HqfSJQ+JxjdxM6TL4rzgXex0JDj7h1hAw8YC8qA4QBXxxVpTZlgxcHuqWJfZ5Y9UlOQ2Yoj2rhuzwDFdPz7VfmYyi5YqRQs3577csAcwF43UjHX7AM5bdESSr3sI++Xt5MZ4wj/WDT3GPpaBPPiir2SyGlcLWFTAledEpUTtHlAvSfwZ0DrKynq75O9LrL0t707WHhhggWH5B/ozKqbgjZg6i0f+cyDZ6/i1MotGS+0RO21K00i9MNTmwyUz9IGMXKl++JOheSPMTEHVKArww/qog/FR+Wk 4EHUcE69 eQmC8I5NpLnhcCkWgSbaB6kwMstUSjP0iviCp0s7sZH7eygiUDiBdbb5uc4la5DyLAGPXyKVgk4FsiZ1WZrMTNw1kTv7pTrQeHI0plhCPA+TW3xTRcv+lU03iwsZ1bRVSYyC41tlG7K0CQ/BA+oS6F634eSaslX3WbrWC7G0mtHN/C04336m7dtzEBwiRysNsY1BxLd4LhoPyZsVtOKYC2j0KCJb/h8oOLFgyqpuihcluukskleQ3csbspg9z/mHwsunVqA0NiwSIlMDJa/Q9BbLQWwZLH6wyYKM3 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 Tue, Jun 10, 2025 at 12:53:11PM +0200, Michal Koutný wrote: > On Mon, Jun 09, 2025 at 03:56:08PM -0700, Shakeel Butt wrote: > > BPF programs can run in nmi context and may trigger memcg charged memory > > allocation in such context. Recently linux added support to nmi safe > > page allocation along with memcg charging of such allocations. However > > the kmalloc/slab support and corresponding memcg charging is still > > lacking, > > > > To provide nmi safe support for memcg charging for kmalloc/slab > > allocations, we need nmi safe memcg stats and for that we need nmi safe > > css_rstat_updated() which adds the given cgroup state whose stats are > > updated into the per-cpu per-ss update tree. This series took the aim to > > make css_rstat_updated() nmi safe. > > memcg charging relies on page counters and per-cpu stocks. > css_rstat_updated() is "only" for statistics (which has admiteddly some > in-kernel consumers but those are already affected by batching and > flushing errors). > > Have I missed some updates that make css_rstat_updated() calls critical > for memcg charging? I'd find it useful to explain this aspect more in > the cover letter. For kernel memory, the charging and stats (MEMCG_KMEM, NR_SLAB_RECLAIMABLE_B, NR_SLAB_UNRECLAIMABLE_B) updates happen together. I will add a line or two in the next version.