Message ID | 20240221194052.927623-22-surenb@google.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1260635dyc; Wed, 21 Feb 2024 11:50:45 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUk67+ehpc3Ro/SeEMeJghM5PV7BN17NRNOCTkzTkFVZ32GFj3FQQV/5BWSCBAZ7McWsOpSd49P/p3UwzcfeEJc++wv3g== X-Google-Smtp-Source: AGHT+IGzfXcKf9eb/Fa7kDsRpmR0DWcaqosku2mOT5AMcdwJ3WQjBOCs8B/RLILQAa/gwwMdg3Du X-Received: by 2002:a17:902:aa91:b0:1d8:eb2b:7b26 with SMTP id d17-20020a170902aa9100b001d8eb2b7b26mr15377136plr.49.1708545045301; Wed, 21 Feb 2024 11:50:45 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708545045; cv=pass; d=google.com; s=arc-20160816; b=p1PSCtgiSw9uKEPJ+MOm7XGRw2HiZPhL1vbb61Ok5TXgrDoZFkQIKBUcIX/nZmz5yJ 03jXiV8ivNvIn3joCZr1sA3qysWmAy5PJWtQLaIWaX/wPEfEWQxDIQFBbqSLoNYlqZc6 dX5t19xYF00/IvLWKuNAjtk/4dIQkF+Sy7d1YCNCMjB3grIdDB5BQL6T7akJj+IzTVN4 A8+sI6ez0MGkmaapCvAIZp1X4xE5U0w9bBIFhCIsRz9OgPD/qsLARIhK7XVW+565UKRo DiooRbN2j/qrB6LkokoofOXVWHJtnJCnKuIl3yaMIJBfPKT2dGM//cVDd8uXTLhMAOOG IMrg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:from:subject:message-id:references:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:in-reply-to:date :dkim-signature; bh=4D2ym4tmaIuNf1w08quK73QR9EK/cyrgSXHS1sTLYhg=; fh=1cmPSIgAG/tAPMxbEYzoHmqkj8SMdeUIxYf3uD+6hmI=; b=f75VKOT4X36kkPwfRirQZYt108oSWGXwqjm5VWsbmaaPcFQAmGw8BDOsq/F2pgk+bX 4rI7WodcprOJO2ZX0z0OVirm5ROXch2iMK25zYzeSZwQhLVv7PXw+43xh+inISbT2P2M E34W/sg3zAs9SpDsnsZCaDRwtPjG1oqEYyK3sdvwJlKcp5BYt19b1m6KNcBxIRAUoc23 akTDIp6M0/+Sfxi2UDcta2j98fXh2twieZHyj6q0o1WeUQBi96Qb8QDKoAC6dlgSRCO+ d/zNqT/T1c5WLg/uyxFjR6XCYKSujV9W1/J+kDcVHVxzGkb5T1iCbKOmeiq2vS5fksXC tHew==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GuV3TJ3M; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id h10-20020a170902f54a00b001d8e2c08e1asi5920479plf.70.2024.02.21.11.50.45 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Feb 2024 11:50:45 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=GuV3TJ3M; arc=pass (i=1 spf=pass spfdomain=flex--surenb.bounces.google.com dkim=pass dkdomain=google.com dmarc=pass fromdomain=google.com); spf=pass (google.com: domain of linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-75400-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 14BD02823C1 for <ouuuleilei@gmail.com>; Wed, 21 Feb 2024 19:50:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EA3F6126F1D; Wed, 21 Feb 2024 19:41:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="GuV3TJ3M" Received: from mail-yw1-f201.google.com (mail-yw1-f201.google.com [209.85.128.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E671C126F01 for <linux-kernel@vger.kernel.org>; Wed, 21 Feb 2024 19:41:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544505; cv=none; b=SB5/Bah5VQbtQ0gylpKyieCYY+P6bvVmaQ8uo44MAKF+XwHa10/uTtnsfUClizxjcIk7CVCrE3sXPI3JI6RQUGRW+amD0q9w+K2x+54nN41Ydf3yFgk5gfyvPgpIPN2aWcOXuXjJ0wbYaHbk//qsC9DUDHArBEaAN+RzdT3kf34= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708544505; c=relaxed/simple; bh=tyIikjJlrYyNLJoOHRGtPA/wKSTMkEiPDo19C/DYXH4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=vBURD0SWB4FlsH2X4I6tsYiqU/c/Oc8Cu21+okoPUr/ZrBDTpI6a8RcIfIqwXoZXeli/3xZyZEzUL+cQkXDuiqwwYSU5U+ec9v7ZFFoWMy77fr8kfAf9vRxnfy+Wz53txba3XYuQE/HUsYPLEUp5eAhR3IMzu7Mvka5KgcLwHpE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=GuV3TJ3M; arc=none smtp.client-ip=209.85.128.201 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--surenb.bounces.google.com Received: by mail-yw1-f201.google.com with SMTP id 00721157ae682-608835a1febso18654357b3.2 for <linux-kernel@vger.kernel.org>; Wed, 21 Feb 2024 11:41:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1708544503; x=1709149303; darn=vger.kernel.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=4D2ym4tmaIuNf1w08quK73QR9EK/cyrgSXHS1sTLYhg=; b=GuV3TJ3MrI71MbxE34f/5qi8JNdui5fJUINhuMdeX1pUpXOUTj7yHD3Eld8RsYWH8f M/bNF47TLDvzMTaikAwQfx5WddNrQm6sqCLiOiARVX7t+xQ7Eq5H7GY4kcchBe3XFPMM HAVGsc1rrSCkuU8pLk5mAWeFBMxrfkeRSXQp6E908UePDaoCInUbhxotyQX2qhK5w/wI j2SdaGwjQqVMqvULZDe0ZO0V316WYJSGZI/mCCndvhtjVEoU8Bja0evFw0h1iM6XbYBG qlc3/mtkzf3fQG2/AG70AhJGtroFax1I18GSPlZL8f4nBZRtDCg0p0AiAVunFN34nnap p/4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708544503; x=1709149303; 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=4D2ym4tmaIuNf1w08quK73QR9EK/cyrgSXHS1sTLYhg=; b=VkvNNn0DSUPM3flj+iBuQA8w25mXWgbWJmI/6tppdTIOb5GrEGMZfqQ8Kz2uQmx4Xt 8FP0ycUXDqhCXmjNK2cEbG5FiX70uw2eeji1GwMbH8qp8zcYRe9CtXbmMqAwShlPyNsp PCJ1jtRaXQj8jcnczGX0SeyBWMrikJi6o6fvcWrGVH/xlgyWK9aw/tCQ6EVIVVh6F47X WeTOlA1zQfAFpPymxltDu7kpofdal0tphZIShCFQbX+quzNhdCoQEIVbICB25g4aMXEH LjET4BPE85twssBCSNXQaq2mG10KdP8rRTpg0HovLY7vjV6FDR90AEPzJmhJcRStwTi9 yamA== X-Forwarded-Encrypted: i=1; AJvYcCUZwi/LZDWZWmwL+gDzEHIou4kTd2HDTopvRdhzTq0tV80rCsIOFqYspYgHR/sCDYRkQn/R+xxhL1DSVHPsF5/az0/fp9bJseHZJzs2 X-Gm-Message-State: AOJu0Yx9cd5bSGHUbCv/5JoNCA6ZYl4siWux4cCrvtnIqWR3V22zGHhI AX7WhG8FNgu/FH3B3Pb3A0KDzcyjlH/W1uBS3ry/smftvfPwL34rRxW5HP8ruDdYWUdW7wbH9S3 kRw== X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:953b:9a4e:1e10:3f07]) (user=surenb job=sendgmr) by 2002:a0d:e611:0:b0:607:9268:6665 with SMTP id p17-20020a0de611000000b0060792686665mr4677003ywe.10.1708544502298; Wed, 21 Feb 2024 11:41:42 -0800 (PST) Date: Wed, 21 Feb 2024 11:40:34 -0800 In-Reply-To: <20240221194052.927623-1-surenb@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> Mime-Version: 1.0 References: <20240221194052.927623-1-surenb@google.com> X-Mailer: git-send-email 2.44.0.rc0.258.g7320e95886-goog Message-ID: <20240221194052.927623-22-surenb@google.com> Subject: [PATCH v4 21/36] lib: add codetag reference into slabobj_ext From: Suren Baghdasaryan <surenb@google.com> 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, 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, 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 Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791539329588624214 X-GMAIL-MSGID: 1791539329588624214 |
Series |
Memory allocation profiling
|
|
Commit Message
Suren Baghdasaryan
Feb. 21, 2024, 7:40 p.m. UTC
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 <surenb@google.com> Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev> Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> --- include/linux/memcontrol.h | 5 +++++ lib/Kconfig.debug | 1 + 2 files changed, 6 insertions(+)
Comments
On 2/21/24 20:40, Suren Baghdasaryan wrote: > 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 <surenb@google.com> > Co-developed-by: Kent Overstreet <kent.overstreet@linux.dev> > Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev> Reviewed-by: Vlastimil Babka <vbabka@suse.cz> > --- > 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 f3584e98b640..2b010316016c 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 7bbdb0ddb011..9ecfcdb54417 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
diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h index f3584e98b640..2b010316016c 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 7bbdb0ddb011..9ecfcdb54417 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