From patchwork Thu Mar 21 16:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13599179 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 5500DC54E58 for ; Thu, 21 Mar 2024 16:38:21 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 12CFA6B00B4; Thu, 21 Mar 2024 12:38:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 091476B00B6; Thu, 21 Mar 2024 12:38:00 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D60376B00B7; Thu, 21 Mar 2024 12:38:00 -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 BE4B46B00B4 for ; Thu, 21 Mar 2024 12:38:00 -0400 (EDT) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 9168EA0A7D for ; Thu, 21 Mar 2024 16:38:00 +0000 (UTC) X-FDA: 81921603120.03.2BDC95B Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf21.hostedemail.com (Postfix) with ESMTP id C0DDA1C001F for ; Thu, 21 Mar 2024 16:37:58 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="QFwO/4dg"; spf=pass (imf21.hostedemail.com: domain of 3ZWL8ZQYKCFICEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ZWL8ZQYKCFICEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.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=1711039078; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pOwNrbZCC43nJVxac3Uw9hAvg9K+bdh2+QxQ9H95ZLk=; b=B5MbQUVKBxIc0JttZzMLdg5mKXLE1Xwyn/5aQbQqNJ9BKA2CX9AC8P0mizycId6R1PPtIg aBcYTivbfsuC7jXwRFQgUON7q7BpsaJlDbF9ZLxQO3v5rXvSvgAGp3kruBO4jj9p9UbcGd hZnynI2YpuA6rxuAdlJJf62s+dO9HXM= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b="QFwO/4dg"; spf=pass (imf21.hostedemail.com: domain of 3ZWL8ZQYKCFICEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3ZWL8ZQYKCFICEBy7v08805y.w86527EH-664Fuw4.8B0@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711039078; a=rsa-sha256; cv=none; b=bHbikyMrtfue+Nu6dGWe+BVAmaEXRBxydNP5BNAQXPW09/rH+l9n/0mSyZftMDIm/mFc+G 6q4AXt/lycq2B6t7frNFJv1XeZ7XpGyyRMe7O3Hz+IDkjsQzOHKt8YoFaNSZyfamX5qNB/ S9aaGzt7bHJogYGtytSbqjTdyGLILw8= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-60cd041665bso21148677b3.0 for ; Thu, 21 Mar 2024 09:37:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711039078; x=1711643878; darn=kvack.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=pOwNrbZCC43nJVxac3Uw9hAvg9K+bdh2+QxQ9H95ZLk=; b=QFwO/4dgq74wPf4IWAurAET6IuOUiYnSAs3sZ823RKYINpCFnWB0XzND/wqITjDQ6F fH3YLXPXBwILc6IZUh1kCyPEDoQB0ZDVsgPfgFYXwYhMgqJqOEE9mCgzMCHtQAP34dAQ WEIyXnaK0e4Izw0Ff9tdQoPUwpt9WXyE9LpfeeBH3B6Mm970kke8LThIgAffyUAu76nF meY2Ai/Bdp7Vj5hVOzaCOzM4eKOB934T6zgCjBvM1Rz3T/aXbAq1yEqtGip/WbIu59oa 0GWNaxhPFNROww4PF5bgzVfSqQkv5OsQL9FSlPUq+siGaqEdyvumyKNtIIBhKGlB89tF zxjQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039078; x=1711643878; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=pOwNrbZCC43nJVxac3Uw9hAvg9K+bdh2+QxQ9H95ZLk=; b=jpttifuc/ynXE3D+AZ0FCdgMGo1cyV+slrW9eQLVqxqjPOVNX9+knpvngOsy3b2GUC FDGhAGJchEvS8cQZV/61myfZR6jdBqJQKDky0A648PVIKWwu5+X0gLa460vlgO4faVdN ao/YCU3+rp1pmDx3Wmrx9kaIPFvG3WXPBuuBCxitV4zVPLqjrDf+K14yA46cX0m3pVbA aK20p5mMncWsx9rxTxsS6LPC0OBWlJpCQQq57tjt0pVbvKGjtnBMJVyYIE9zrQL+8p+h sqOiZmIdIWN1DlDQjR5qqp6yf3PsZs2ZqLc0mhLXySEszPdhuhvhdzFNH/lHxelTSCkU R+Ig== X-Forwarded-Encrypted: i=1; AJvYcCUFP4SVc2/94mXTKrwqSwEfavIhzkTjgtZlrxWYU+tvPeB4QPRYodBb9pBJM1Lj8WGhTx7mIOe2vKKYRvQF33ekrR8= X-Gm-Message-State: AOJu0YyAYGZRKHElsPD/veV2HH/b69tBwDJiRd+nl76Xvv0RhSdcVWKn u/CcV6L1hJXSwWD5l8t9HQlb76Oaj6c3Inctc/cUs562qnFzgiVJrLb5xtIZstOFiYmHZvH0CkL PdQ== X-Google-Smtp-Source: AGHT+IEW+wzJaTFBqhE05AsZZeHucxp+/bXHicD4m92IkMS+am09AVJUNTX8XqOhkKHJop6Lzvm1ThHm3tA= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:a489:6433:be5d:e639]) (user=surenb job=sendgmr) by 2002:a05:6902:1004:b0:dc7:5aad:8965 with SMTP id w4-20020a056902100400b00dc75aad8965mr5894352ybt.0.1711039077542; Thu, 21 Mar 2024 09:37:57 -0700 (PDT) Date: Thu, 21 Mar 2024 09:36:44 -0700 In-Reply-To: <20240321163705.3067592-1-surenb@google.com> Mime-Version: 1.0 References: <20240321163705.3067592-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.291.gc1ea87d7ee-goog Message-ID: <20240321163705.3067592-23-surenb@google.com> Subject: [PATCH v6 22/37] lib: add codetag reference into slabobj_ext From: Suren Baghdasaryan To: akpm@linux-foundation.org Cc: kent.overstreet@linux.dev, mhocko@suse.com, vbabka@suse.cz, hannes@cmpxchg.org, roman.gushchin@linux.dev, mgorman@suse.de, dave@stgolabs.net, willy@infradead.org, liam.howlett@oracle.com, penguin-kernel@i-love.sakura.ne.jp, 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, jhubbard@nvidia.com, 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, songmuchun@bytedance.com, jbaron@akamai.com, aliceryhl@google.com, rientjes@google.com, minchan@google.com, kaleshsingh@google.com, surenb@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 X-Rspamd-Queue-Id: C0DDA1C001F X-Rspam-User: X-Stat-Signature: 4t87d5xybet7kzku79ghhignj7kdho1x X-Rspamd-Server: rspam01 X-HE-Tag: 1711039078-891810 X-HE-Meta: U2FsdGVkX18ibjKTcNQtJT/S2dmgJZ5uqzNrd4MbYYaf25OiyONoAMBP1wt5bD1qdbStgqKCcghVYFb1Wp1+i08fJhluaDAcAXgKgjXRV5lPuu1xsRQ5ZovXgzp/VGbQDwf8Ii1K7qqPx8/GjkLUtxQ4zT2jL9GiV43FgzVJlhKcRSM/Huq882z1B2fmt4b0JfsQBHirfG3rYzxNT+jX6x5/LaiIAcqT/UnVRe2HFhzmGq9iVu8belsWvenZgGrs0E5nBtePn33wpW7oBYIym5GYTbUap5NIGItZodf+Ac+UPkAsck15LHRrUSZvPrDg9SxFHAkCGYrj73Q0Q8i5ZgV1qSzVjQ862s0YRPmyRrCmBS+oqOnGEILJ6gfT4DHkCWODV41r5X0H5Vlim5zvK3Hpf2ST63DMl55YtZgf6x394cUVt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pDWqqO9UUnEvb99x9UUkELjRrnQbLhGpcVVQXqreCLWJ3VWp5jv/TxuxJSnjR+0zRveCQH6m1IoP3YBMTl12xLfLsMl3Siiz0YhfD8VgFElwj6PDyPeYxV+4RmZ5uvshlGeoPgz+MRFxAjbrP5sftbZNxufI6WN0AD4WWWq1UomIJA8AyWIF9oQFJgBypRzmyW0Tik7BmvqxocVq7ASWTb/5KvGLIocFSzCpcOgjDSZKj 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: To store code tag for every slab object, a codetag reference is embedded into slabobj_ext when CONFIG_MEM_ALLOC_PROFILING=y. Signed-off-by: Suren Baghdasaryan Co-developed-by: Kent Overstreet Signed-off-by: Kent Overstreet Reviewed-by: Vlastimil Babka --- include/linux/memcontrol.h | 5 +++++ lib/Kconfig.debug | 1 + 2 files changed, 6 insertions(+) diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index 12afc2647cf0..24a6df30be49 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1653,7 +1653,12 @@ unsigned long mem_cgroup_soft_limit_reclaim(pg_data_t *pgdat, int order, * if MEMCG_DATA_OBJEXTS is set. */ struct slabobj_ext { +#ifdef CONFIG_MEMCG_KMEM struct obj_cgroup *objcg; +#endif +#ifdef CONFIG_MEM_ALLOC_PROFILING + union codetag_ref ref; +#endif } __aligned(8); static inline void __inc_lruvec_kmem_state(void *p, enum node_stat_item idx) diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index ca2c466056d5..dd44118e7337 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug @@ -979,6 +979,7 @@ config MEM_ALLOC_PROFILING depends on !DEBUG_FORCE_WEAK_PER_CPU select CODE_TAGGING select PAGE_EXTENSION + select SLAB_OBJ_EXT help Track allocation source code and record total allocation size initiated at that code location. The mechanism can be used to track