Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1218553rdb; Fri, 16 Feb 2024 08:39:33 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVbywNEAtTH+EPUUgqkuPhU7pa7EzA5U+8v3XaXCv44WL7hGWctuTECp7VBAHmgsyGvKrb9RZOJdnuhPr3FCh+wJ3BenyTsLtMd8LOMdQ== X-Google-Smtp-Source: AGHT+IFyM2VJe7i+4k+hGxUONZsRG2tb8dbw25kg3WLAo45Q0hgN/ppCcuXVyhtOYL5G6lHLBHDa X-Received: by 2002:a0c:aa5d:0:b0:68f:1aa7:12bf with SMTP id e29-20020a0caa5d000000b0068f1aa712bfmr4701723qvb.22.1708101573039; Fri, 16 Feb 2024 08:39:33 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708101573; cv=pass; d=google.com; s=arc-20160816; b=R4l3weff0xrUDf8sySzZZPeb0neyRwBHK0yV+ZLyJ/2CnqJlIJ6ddZyot+tnnOQmTv zmdUqxto18YpcMJxxzR3knIAX0EI01A+dj1szwGxCihV1uvU/1400+KlmmYSZRBbm9cz 8J1FnsbQ4Tm64plKh6Rkhlagh97vxNZfIw+LcY8tlLemm1hiAyw8egXA+z5MD+VSzEOX c3kOzO2kPdCWjki9YNokUsuyMKYuh/o0swvNm6Y+nusA3xx2K9KCaJheNBKrndGay/Ws t6twD/jjcLZ1x/ngeUQiADwoAjRCXnq3bBeJBda2zv+1oe0WqHBMM3xK7E2cXp8/HmzV bDnw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:dkim-signature:date; bh=ykstDffvORkHR/QBul+dunCrpEbnMsgllsNmRKwgALQ=; fh=oLzH21GokMW2l86dFsMPozOxCJDwxgKqQI1fOLLTHJM=; b=ar8QTrciDs5KCnf5kc8YRPIOFEhcitHSwy8lOBokZvlLOjxJkj+6nhVgF/9x4I6MUI sPL2WH87KkOynrsYeZ4+te+f9bKDWE+874D+PrRHr6Q9qeAmhPXAyYR7R9SUf4zukf2a EiypooFZuNblGU8rbh8GbkdsVSQ1HuygwdKrgD50ya55ro46GStqEIKc8TEQdJVTydnx CPp9wGkUspmawxPrwk8OJ0kfRxLFOwCdq0/K8GwYW9CBSvuIfFoewlIR3OUo6uAijDKS z2LqzBBIU6maJq7kMbIulDb/6TrX6IQp/gsUeV67zH5uJGiAkY2ZzJ6i2g3MzwApkcG2 w4+Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="P/rHKmX3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-68969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68969-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id gw8-20020a0562140f0800b0068f3dcecb2bsi111390qvb.288.2024.02.16.08.39.32 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 08:39:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-68969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b="P/rHKmX3"; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-68969-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-68969-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id C6FF31C21526 for ; Fri, 16 Feb 2024 16:39:32 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C4EC3130E25; Fri, 16 Feb 2024 16:39:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="P/rHKmX3" Received: from out-187.mta0.migadu.com (out-187.mta0.migadu.com [91.218.175.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 1B3AD130AF6 for ; Fri, 16 Feb 2024 16:39:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.187 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708101554; cv=none; b=RQqM3m8X7lZiB/HnjAzoW23q2Q3qu/9v4FAjndGZPxRkriTZ14dP1WdaMHOJxzPSKTxAU20ituazU32h7QlynkrzhXmeYngukk+13ZLU2KUoIhE5F7CEVNwqHaxsn3vXRbU63HDfB8wtbup9ZKA+fusCgm0XrzR7T4hc1FosC+8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708101554; c=relaxed/simple; bh=PkWRMaDgTly/5ez9/SA93u9YGwFkohBiRhZ2gvWvgoY=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WUFLzknWhFstODrY3O1ny1/JT/1Z61GmnSc7Epmbyhfp7Nf05aJIvmazc0d0VLj9RV3bP4BgyKuEe26lFbV/F1pRAb1raAhlK02fj6T0qXXH45byo0MD2SO6U6Qw5WK2C2m7tbG3RuqdiwGJy6MjZzqMlzn3O/85rpI9Bj5cIog= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=P/rHKmX3; arc=none smtp.client-ip=91.218.175.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Date: Fri, 16 Feb 2024 11:38:59 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1708101549; 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: in-reply-to:in-reply-to:references:references; bh=ykstDffvORkHR/QBul+dunCrpEbnMsgllsNmRKwgALQ=; b=P/rHKmX3j/prO7tgG2j74FOBqArykGjAD+QXCi/CNWHvRgoNUgOhhnMDCES9P7PyrRETo+ l/VeuBrESrdYcr+HcB7pGshKvMzuIAFjDfuOhDowTTeo3OT984nPcJzcavwvweaH8hU/1B 3Wof2PoerJMLJIVUnvZFOQj0zf3N6Rg= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Vlastimil Babka Cc: Suren Baghdasaryan , akpm@linux-foundation.org, mhocko@suse.com, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, corbet@lwn.net, void@manifault.com, peterz@infradead.org, juri.lelli@redhat.com, catalin.marinas@arm.com, will@kernel.org, arnd@arndb.de, tglx@linutronix.de, mingo@redhat.com, dave.hansen@linux.intel.com, x86@kernel.org, peterx@redhat.com, david@redhat.com, axboe@kernel.dk, mcgrof@kernel.org, masahiroy@kernel.org, nathan@kernel.org, dennis@kernel.org, tj@kernel.org, muchun.song@linux.dev, rppt@kernel.org, paulmck@kernel.org, pasha.tatashin@soleen.com, yosryahmed@google.com, yuzhao@google.com, dhowells@redhat.com, hughd@google.com, andreyknvl@gmail.com, keescook@chromium.org, ndesaulniers@google.com, vvvvvv@google.com, gregkh@linuxfoundation.org, ebiggers@google.com, ytcoode@gmail.com, vincent.guittot@linaro.org, dietmar.eggemann@arm.com, rostedt@goodmis.org, bsegall@google.com, bristot@redhat.com, vschneid@redhat.com, cl@linux.com, penberg@kernel.org, iamjoonsoo.kim@lge.com, 42.hyeyoo@gmail.com, glider@google.com, elver@google.com, dvyukov@google.com, shakeelb@google.com, songmuchun@bytedance.com, jbaron@akamai.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, kernel-team@android.com, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, iommu@lists.linux.dev, linux-arch@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, kasan-dev@googlegroups.com, cgroups@vger.kernel.org Subject: Re: [PATCH v3 21/35] mm/slab: add allocation accounting into slab allocation and free paths Message-ID: References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-22-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Migadu-Flow: FLOW_OUT On Fri, Feb 16, 2024 at 05:31:11PM +0100, Vlastimil Babka wrote: > On 2/12/24 22:39, Suren Baghdasaryan wrote: > > Account slab allocations using codetag reference embedded into slabobj_ext. > > > > Signed-off-by: Suren Baghdasaryan > > Co-developed-by: Kent Overstreet > > Signed-off-by: Kent Overstreet > > --- > > mm/slab.h | 26 ++++++++++++++++++++++++++ > > mm/slub.c | 5 +++++ > > 2 files changed, 31 insertions(+) > > > > diff --git a/mm/slab.h b/mm/slab.h > > index 224a4b2305fb..c4bd0d5348cb 100644 > > --- a/mm/slab.h > > +++ b/mm/slab.h > > @@ -629,6 +629,32 @@ prepare_slab_obj_exts_hook(struct kmem_cache *s, gfp_t flags, void *p) > > > > #endif /* CONFIG_SLAB_OBJ_EXT */ > > > > +#ifdef CONFIG_MEM_ALLOC_PROFILING > > + > > +static inline void alloc_tagging_slab_free_hook(struct kmem_cache *s, struct slab *slab, > > + void **p, int objects) > > +{ > > + struct slabobj_ext *obj_exts; > > + int i; > > + > > + obj_exts = slab_obj_exts(slab); > > + if (!obj_exts) > > + return; > > + > > + for (i = 0; i < objects; i++) { > > + unsigned int off = obj_to_index(s, slab, p[i]); > > + > > + alloc_tag_sub(&obj_exts[off].ref, s->size); > > + } > > +} > > + > > +#else > > + > > +static inline void alloc_tagging_slab_free_hook(struct kmem_cache *s, struct slab *slab, > > + void **p, int objects) {} > > + > > +#endif /* CONFIG_MEM_ALLOC_PROFILING */ > > You don't actually use the alloc_tagging_slab_free_hook() anywhere? I see > it's in the next patch, but logically should belong to this one. I don't think it makes any sense to quibble about introducing something in one patch that's not used until the next patch; often times, it's just easier to review that way.