From patchwork Wed Mar 6 18:24:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13584432 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 9C7B2C5475B for ; Wed, 6 Mar 2024 18:25:53 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2262C6B00AE; Wed, 6 Mar 2024 13:25:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 186C26B00AF; Wed, 6 Mar 2024 13:25:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ECD646B00B0; Wed, 6 Mar 2024 13:25:34 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id D58D76B00AE for ; Wed, 6 Mar 2024 13:25:34 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id B2F86120144 for ; Wed, 6 Mar 2024 18:25:34 +0000 (UTC) X-FDA: 81867442188.02.7A24E63 Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) by imf17.hostedemail.com (Postfix) with ESMTP id 16A6A4001F for ; Wed, 6 Mar 2024 18:25:32 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=acOId87S; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3HLXoZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3HLXoZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1709749533; 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=rg6IJ0Q4L7KBxRODnLb4yefimTum4BvWKaOTt5/YB2o=; b=aeo8EF3T+Ja9dxB2j+qZNvfDMOx+NjQr50P8D6yLkqcjr97cIsVIs3wxnbRspg0WioJdH2 SWID/taNEqc21QRZZI5pcBJ6u/HdclnwqzLBlitxlzeFdK6kSc7vltbe3MtD1B1mWbao00 7vI6q46EBMM8X8U1V1mJf2i00hgqUZw= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=acOId87S; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf17.hostedemail.com: domain of 3HLXoZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.128.201 as permitted sender) smtp.mailfrom=3HLXoZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1709749533; a=rsa-sha256; cv=none; b=U5yo9UDshx0ntqS90DuOWEe35rIV73xRqf9T4D1rNtE/N4bbd7Qk98aM7PrnK3xFtC064p EpNfSJvARcGshrwrjyeR/KiU0ZOMsLUrO4GTD0H6hk8s4FYaB4It0TlXMMgLOMiDv+bZ70 3zMhwA9g9uEj6/mQb9QShP0qtmHCwz0= Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-60996cdc37cso164217b3.2 for ; Wed, 06 Mar 2024 10:25:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1709749532; x=1710354332; 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=rg6IJ0Q4L7KBxRODnLb4yefimTum4BvWKaOTt5/YB2o=; b=acOId87SQE/40NNvc1vLrh+faf4TReBgkFFCeva/2Kl9WjfZl8z0wu/cI51DxZovLY NsTNOwfE5BeBS5ToYhbafNpK05FPryqBOmGGfJ6/i0csCDp3HDxlBRbE+qkKkiYUu66P 4dB4X+Xd/V2vTzyjpDM5GbTKa9gQo5mSXZHEYwNJjmCCpK04b1gKB0RZjSMULuHgbfnC E5bADp3BHE77BnckiOgv+knnDziuAiRyG4TDgtkD0uiGVY2999rFro9J6SX4XcCGiPGM uVOL9TZj7dj7/AoChXjLEEvqJyDYHK0Clm13UGLjjXxBxUooB0BtlUyapau9I/aR58R+ jnHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709749532; x=1710354332; 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=rg6IJ0Q4L7KBxRODnLb4yefimTum4BvWKaOTt5/YB2o=; b=R22pGkDVz96+xLPf6bnvSW74jVt6ZRp3x46HL4MB4wnFidywubnTIthiSVhmK4WTQi atzTW1CGTOc2LGrzVIdI8Gga37SYtMZ+0Mzmov5lp5ZEn7VpxRfiXr98l0/qzq+UKyKG xdrP7BhkpDIq5iGbwTx8fqpL7+XaWEMKSRfOwfY/FHMPGeZRdMEyMMk/R/QB+fpsT2dl 2CsxGyDpSFllEmrRns9UJGVkt5NT/s8w5OaYNk70oxuxKftAQVE2J0ejkwI4Pjnw0g5T Qqi8YKEf+NjpAO0qKqrpNCMVyMk4yB+Esw0q/4ZIBe6XL8BNHCEIARRY25Fkx4DifgWR rdpw== X-Forwarded-Encrypted: i=1; AJvYcCU6uEDnR8n4GRcFC9WX+kyz6xDuVh+i8YTOdYOaljYrJg4c9QdI+K777yErRbvze5DZWvJdePaD+Mim49QGL0MSMR8= X-Gm-Message-State: AOJu0Yy+kR89KE4VRGMlAMqH5AMmsioOudHE5H7+3gd6TcprbCoW16ql 3QmegqEsxMcvKuAGOw6skjkKoJ+LaL08DhLCeHmsnRjqpXrZhNL5K2J1SZMnlRUalgLTECzWvHf a2Q== X-Google-Smtp-Source: AGHT+IF+RFcX0NYxjT6uNvnW+K0lH94IF3O72VJ6PT7ea1CL+TwW9QtFKtQNO2MOoPPDxhg0sWNTYKHdXg0= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:85f0:e3db:db05:85e2]) (user=surenb job=sendgmr) by 2002:a81:9945:0:b0:609:781f:a7ab with SMTP id q66-20020a819945000000b00609781fa7abmr3355582ywg.1.1709749532080; Wed, 06 Mar 2024 10:25:32 -0800 (PST) Date: Wed, 6 Mar 2024 10:24:20 -0800 In-Reply-To: <20240306182440.2003814-1-surenb@google.com> Mime-Version: 1.0 References: <20240306182440.2003814-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.278.ge034bb2e1d-goog Message-ID: <20240306182440.2003814-23-surenb@google.com> Subject: [PATCH v5 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, shakeelb@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: 16A6A4001F X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: q8btowh1auiex9xf74wj4hb9w7nypx5x X-HE-Tag: 1709749532-154884 X-HE-Meta: U2FsdGVkX18bNrbfiuA9/dIO4xxAXstAlnvr2GpItvQuuMsul9usFyajzatWBo0nltP4MF0WgcNWRqcY9gyEZL/Do6UrieTQXHqPDo+RRwzdPuae8kHiZqz1wD3jqtBeucd+4WVOtQ5+3QnXq6iqyAecwm7F8W9CH0wpjY1N3Vj5DFjd6YoXRwHJanAc8OmqjzDx1GHRtP8/b7sk3mC5oFPMdfhuaNBF4+I7rScS3Wm4D3mntg7koLRD3090m9zkddxgC5dZM+m5x1Bd6EIJVtmH4K/DZp6+XzgRvs7fy9mu2/WHx/Xm5l90pqS9hVzr/lTuM8Ox9XPQBs4al42M6M05kDtapBbHGoSURReVb/Iic0EEKJYdjALs8jKE/NGLycshMpcRB5zqYmCGorBKXw/ZBMxjvMt2LywjmieSUYTdXuPtJwWpWvpznx/6U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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 7709fc3f8f5f..33cdb995751e 100644 --- a/include/linux/memcontrol.h +++ b/include/linux/memcontrol.h @@ -1652,7 +1652,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 3e06320474d4..dfb5a03aa47b 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