Message ID | 20240321163705.3067592-29-surenb@google.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 40472C6FD1F for <linux-mm@archiver.kernel.org>; Thu, 21 Mar 2024 16:38:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F38636B00BC; Thu, 21 Mar 2024 12:38:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EC0F76B00BD; Thu, 21 Mar 2024 12:38:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D11366B00BE; Thu, 21 Mar 2024 12:38:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id BE02F6B00BC for <linux-mm@kvack.org>; Thu, 21 Mar 2024 12:38:13 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 94B6780473 for <linux-mm@kvack.org>; Thu, 21 Mar 2024 16:38:13 +0000 (UTC) X-FDA: 81921603666.19.41DBA6F Received: from mail-yb1-f201.google.com (mail-yb1-f201.google.com [209.85.219.201]) by imf24.hostedemail.com (Postfix) with ESMTP id BA11E18001B for <linux-mm@kvack.org>; Thu, 21 Mar 2024 16:38:11 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=zH7SHGhG; spf=pass (imf24.hostedemail.com: domain of 3cmL8ZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3cmL8ZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@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=1711039091; 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=krRMCxbEdPvR0gpNvdmt+1GzNi+HHBvoijzlHbN4rmY=; b=yELQTqb8nl0b1MqXs2+ipeiyjEDaaYEX4r5GmtHmt78K/V8DEATF3VvLxrRaivzmLCsAFH pFEdzq8OBJg1V6KVDBDYdNDeURTpXQt8x+hw5xBFX3CD18BkQ+RF3hpS6IgiP4p3U5Ftp7 x6WxvFVT5Ub9E0IoS+Ih41BX+QSQGvQ= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1711039091; a=rsa-sha256; cv=none; b=sND3I2MEp5hdpSDLuBLGDR+z/7M/LQItZ5YoeL3CrToKCcDEph8uqGzyu7AtjfrTfOb4m8 S9PFnKqDVVmL1IASQE4Y5ipfCSHTbl5LZclZae5OVhpSi42lYGelNyR04T4/2rqHwlN3Pl Z0WEQ6tYq9GAbBMl32MDLH3xOiWAOK0= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=zH7SHGhG; spf=pass (imf24.hostedemail.com: domain of 3cmL8ZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com designates 209.85.219.201 as permitted sender) smtp.mailfrom=3cmL8ZQYKCF8PROBK8DLLDIB.9LJIFKRU-JJHS79H.LOD@flex--surenb.bounces.google.com; dmarc=pass (policy=reject) header.from=google.com Received: by mail-yb1-f201.google.com with SMTP id 3f1490d57ef6-dc64b659a9cso1797724276.3 for <linux-mm@kvack.org>; Thu, 21 Mar 2024 09:38:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1711039091; x=1711643891; 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=krRMCxbEdPvR0gpNvdmt+1GzNi+HHBvoijzlHbN4rmY=; b=zH7SHGhGcDAXd3tmt034g5Oki9k0m0jDuaXP+Outd/bWt9kMWYGU9Rdzbt++wVq2Dx GMfDneBBJck+bARsho2i2cqiTSjNEd5+yyNd0K4jsHPJC8rkRaLcEcr2PHvdAOKO7d1h pdR8HQjhY8kjFFcvKB7QlyLxj244ZqkhQHERUiFYb/UnzXxvY/pkVedNWMnFh7qYa9nh WYodJF7HqaKd+hSA7TRrIutPJWx88YJfARqu3SfvL3up8zi9/X+qq6HdMZYaUE1PQZqV 9uMQPLPvnFIUI44iXuwxXutW58Wr7wLIvLGD1RWE8FGFxRaNV3JQbcO8FmSmRDjGLXv1 QdtA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711039091; x=1711643891; 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=krRMCxbEdPvR0gpNvdmt+1GzNi+HHBvoijzlHbN4rmY=; b=YKlJuKBozg9cCySDyxR5/8LI0c449NMSaVoIbvq1COMEOXufmZRJXQC4SVyYgWw1y7 JGpTxyqy2aeMoD0IS3MG73coX1yZZkdZ1+nFdMZ9gdLB5bZFgUDRylYR+e7zTxGKEQki jkJ2NdvRDM2QDXfcVXe00dDtiSCuf17w+4V4g6Tv1NUBm0v3KhXwSoLT9eh7mosY0eLN WKiWEZ8RS6q50oUBy0Iu/NW91GaQBPESGcoBO/kiCW6sOrJYcZ7YbappyykYcCDleuOH eh3B4i1b3BGYFaKp4bExAcNd4bWdLxPYmiYQvJrroQ5OjsiHIF4h2u8imfEVoVl3youU 4KMg== X-Forwarded-Encrypted: i=1; AJvYcCUk7ii7K6YupWIT+sKVbm2BU+5+vozTDIDMRhjpYjPY+j079Hesehevx/LpXXWP6lE47GlnUqDroVN0VfvCTjvfQYE= X-Gm-Message-State: AOJu0Yw/xHcHB6CsPCFuoIJLKk1Yc1b0nt7XPUr3TEKdQXJh8GyxpyLs 1vaPFlbM6EhKKeJrvhrif5Uffjv/SMV/tA0TTFoRyfBu7zIu92u35bWkGU/uLGxeWYA5apUPqeF bvQ== X-Google-Smtp-Source: AGHT+IGHRX7538S2HF/3oOa1sNnpVXnzB+i3nUjYB81n0AdHPc2tfmh7wCvtVRvHYQ8dsZZZ2KX9wsSWPB4= 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:2506:b0:dd1:390a:51e8 with SMTP id dt6-20020a056902250600b00dd1390a51e8mr2395872ybb.10.1711039090742; Thu, 21 Mar 2024 09:38:10 -0700 (PDT) Date: Thu, 21 Mar 2024 09:36:50 -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-29-surenb@google.com> Subject: [PATCH v6 28/37] mm: percpu: Add codetag reference into pcpuobj_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, 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 Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: BA11E18001B X-Rspam-User: X-Stat-Signature: eiby3fyoubzkf8uagth9keuoa5tszo6i X-Rspamd-Server: rspam03 X-HE-Tag: 1711039091-365728 X-HE-Meta: U2FsdGVkX18+YDAbtwAnINi9rligSpg6R1DGi8XCanTMjiBVdqq4x3MnPJtndpDdYLwa/KYBMc7NvJ6GSPjyLEAW+6tVOtIOlQijdG/aXkqYOnsnVLQhpYiFgZxU6G6HgrbayhWkPqZO70wG+dBK7ApcaAsbYJ6FMkX5UOOlELsbXVq2EAGtfGOu2s233Z40wHQvBYT9gFz5hGIPzrvxEoZNxwvkH7gKtd8n3X9wdfXwHYUUZTY8fSZ9iANM8Nrf37zIJ/4J68IWxgiZu2fIQ1rU0Ok2+PFf6GunITODraYGUX3CS2KqF5Ylp118454IdSa7u/eF2Uriw2bYTeMB72eOTv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p5zP0WMBnI9Yxf9UUa3w8ikBqWi1n1W5JgKfkaT9LRlqeueRUm1bd94J/ks0Ka4ZVdIqTWnwgzuUFpuZAPQDtVr1tY0FccpTL0PUr1mLswwk1N44DIuBA95/59g7vQwbIykh4LV9tmc5H5oQPG2o5TXm3hcFbQrFjy+oP9x36en9UQyhXr0CBCkonhsx6fkI9OmlBET4aIfMEBjJLsvQs7WyRLsE9Iob12Ek/yd6Jh8VlP/bIjZWUohCqvwi0lMVu01GkgFzbZ0Ai63Qp3gMrZpmWO4Wf2cc1pn6A1NjLey5TOXgmV3Cp87G 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
Memory allocation profiling
|
expand
|
diff --git a/mm/percpu-internal.h b/mm/percpu-internal.h index e62d582f4bf3..7e42f0ca3b7b 100644 --- a/mm/percpu-internal.h +++ b/mm/percpu-internal.h @@ -36,9 +36,12 @@ struct pcpuobj_ext { #ifdef CONFIG_MEMCG_KMEM struct obj_cgroup *cgroup; #endif +#ifdef CONFIG_MEM_ALLOC_PROFILING + union codetag_ref tag; +#endif }; -#ifdef CONFIG_MEMCG_KMEM +#if defined(CONFIG_MEMCG_KMEM) || defined(CONFIG_MEM_ALLOC_PROFILING) #define NEED_PCPUOBJ_EXT #endif @@ -86,7 +89,11 @@ struct pcpu_chunk { static inline bool need_pcpuobj_ext(void) { - return !mem_cgroup_kmem_disabled(); + if (IS_ENABLED(CONFIG_MEM_ALLOC_PROFILING)) + return true; + if (!mem_cgroup_kmem_disabled()) + return true; + return false; } extern spinlock_t pcpu_lock; diff --git a/mm/percpu.c b/mm/percpu.c index 2e5edaad9cc3..90e9e4004ac9 100644 --- a/mm/percpu.c +++ b/mm/percpu.c @@ -1699,6 +1699,32 @@ static void pcpu_memcg_free_hook(struct pcpu_chunk *chunk, int off, size_t size) } #endif /* CONFIG_MEMCG_KMEM */ +#ifdef CONFIG_MEM_ALLOC_PROFILING +static void pcpu_alloc_tag_alloc_hook(struct pcpu_chunk *chunk, int off, + size_t size) +{ + if (mem_alloc_profiling_enabled() && likely(chunk->obj_exts)) { + alloc_tag_add(&chunk->obj_exts[off >> PCPU_MIN_ALLOC_SHIFT].tag, + current->alloc_tag, size); + } +} + +static void pcpu_alloc_tag_free_hook(struct pcpu_chunk *chunk, int off, size_t size) +{ + if (mem_alloc_profiling_enabled() && likely(chunk->obj_exts)) + alloc_tag_sub(&chunk->obj_exts[off >> PCPU_MIN_ALLOC_SHIFT].tag, size); +} +#else +static void pcpu_alloc_tag_alloc_hook(struct pcpu_chunk *chunk, int off, + size_t size) +{ +} + +static void pcpu_alloc_tag_free_hook(struct pcpu_chunk *chunk, int off, size_t size) +{ +} +#endif + /** * pcpu_alloc - the percpu allocator * @size: size of area to allocate in bytes