From patchwork Mon Feb 12 21:39:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Suren Baghdasaryan X-Patchwork-Id: 13554063 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 D4EE7C4829F for ; Mon, 12 Feb 2024 21:40:50 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 973786B00AC; Mon, 12 Feb 2024 16:40:29 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 923D66B00AD; Mon, 12 Feb 2024 16:40:29 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 776EC6B00AE; Mon, 12 Feb 2024 16:40:29 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 62D276B00AC for ; Mon, 12 Feb 2024 16:40:29 -0500 (EST) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 442621C07F8 for ; Mon, 12 Feb 2024 21:40:29 +0000 (UTC) X-FDA: 81784470978.05.D9B8C54 Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) by imf26.hostedemail.com (Postfix) with ESMTP id A88EF140007 for ; Mon, 12 Feb 2024 21:40:27 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=24Z8e9vd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 3SpDKZQYKCMk796t2qv33v0t.r310x29C-11zAprz.36v@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3SpDKZQYKCMk796t2qv33v0t.r310x29C-11zAprz.36v@flex--surenb.bounces.google.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1707774027; 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=Uyzb7E9FIhn/mbh3tSg2FbzBy8bNHcnwrWfMf2QZXg0=; b=8c6+L4NbbeHsXu6QbWB6P18HVYuX0M2CBgZBsCYKCjpvoq7tzRIqlNLwSoFZEH+bIAa446 BES4x0C4rVnIXI8ilYH3VXGH/Ef5W+Cf0WV+O0oEIaWTuklzDbETIH5qfVRmsLcVlG7oBS ZbgbiXzGpCpZf/LO1gjcxvcvypK9kmg= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=google.com header.s=20230601 header.b=24Z8e9vd; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf26.hostedemail.com: domain of 3SpDKZQYKCMk796t2qv33v0t.r310x29C-11zAprz.36v@flex--surenb.bounces.google.com designates 209.85.128.202 as permitted sender) smtp.mailfrom=3SpDKZQYKCMk796t2qv33v0t.r310x29C-11zAprz.36v@flex--surenb.bounces.google.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1707774027; a=rsa-sha256; cv=none; b=WePWzggj754eFIbyb5xmI/vcElGFmZi/KmKTVnOLKHTTz/6VQoXN5kRB1purHIVNenrY4X Q1zr7YjQZP4vTqW6flWF58nx0/+9FAUWVXG818Gp+LTjmP4u+hPXpc1dIgG4GqB9TsZDLn wo6KT6QaA1F+NAT2X5RrkIAr2RopDNU= Received: by mail-yw1-f202.google.com with SMTP id 00721157ae682-5eba564eb3fso75959537b3.1 for ; Mon, 12 Feb 2024 13:40:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707774027; x=1708378827; 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=Uyzb7E9FIhn/mbh3tSg2FbzBy8bNHcnwrWfMf2QZXg0=; b=24Z8e9vdr5lkgeNMJ84y4TrtOcY5ORZkRi/PBFp0jUzFJYuX3g+pON3Cj91ESqeWO2 6yHtvU1VWU+IIULgcw/p0JEODT5kpvh7Yhd2f/B4sldChED9OE64NWG6ifRY5o2q6jew Z5XIVOEpFCGv7KRxaoaLhNy0iY0x+u43y2Mh6UNXNB14HwrbfoTtRhW2pjxP2jvThlKh TIZ5c7d1wNEzTQN405axe3vSQvXwvwYEQdBxXZQXdXiaTqmrkteSOxGffmjpsxDXCQdy t0fhyg2peUnhGg1xGV3dvKK6lpjp5HWJr19k8/CpR5bbAGvAY2rRUtiEimDnR8ieK23v dvsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707774027; x=1708378827; 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=Uyzb7E9FIhn/mbh3tSg2FbzBy8bNHcnwrWfMf2QZXg0=; b=Im4zTG06V40a6dWFTOE5mH4CfuW/TJFyd22k63F7tUyeIYNd/Ggs9vcX03sT9hmlnT 6csgGjrwnJAvxu7mIyx4h2Ah4w7duBJ9FuKG75iuPVV090qr1yQrGf1vTEq6Zp+YnI79 S8oIqBdEDJ9Rjq6BrZGwNJC82igd/CaXKecK29frhYz27p28WoSgIJOsr8TMEDjcZqmK ig/C5pvmZWx7a0+IUiD8j3yAkpysX0HquxnHslGA282Wnb4KDMOV59MfV9egvlg0+rmX EndxKhgFvGos9jaH/f1Xo4/f9IttsIRKM4CVfXSx5R/1Fh0+6ZJzbIjoRjiKxoUN43YO ZNGQ== X-Forwarded-Encrypted: i=1; AJvYcCXq7H2vam8fzS575UvXcBOUvmmj3lC3lm01pCb3w0p8VY6MmPIm7jfyysZnRNlE+9qr30a/Cz8ol38EicDTLLcKOIM= X-Gm-Message-State: AOJu0YxZfxNGcpKyZfcXQwO7CCdEyjyxr9ArjYcXgJq5M4WiO/QCU8x8 mVPOzDjUa2Rn9WAtle4to4V6N9ciVJeP8KE6TwSca2ijuBM0lE378hqmXA9etx0qOsOng8Lkzw6 N0w== X-Google-Smtp-Source: AGHT+IE5NPp+ufCGF1WHGTLjC5ri/m4V06t1gtAUtmtnTKuKy22ZlehWWdmQuoopo1S/2T4p6wMzddrrcNE= X-Received: from surenb-desktop.mtv.corp.google.com ([2620:15c:211:201:b848:2b3f:be49:9cbc]) (user=surenb job=sendgmr) by 2002:a05:6902:1505:b0:dc7:48ce:d17f with SMTP id q5-20020a056902150500b00dc748ced17fmr2107200ybu.10.1707774026593; Mon, 12 Feb 2024 13:40:26 -0800 (PST) Date: Mon, 12 Feb 2024 13:39:11 -0800 In-Reply-To: <20240212213922.783301-1-surenb@google.com> Mime-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> X-Mailer: git-send-email 2.43.0.687.g38aa6559b0-goog Message-ID: <20240212213922.783301-26-surenb@google.com> Subject: [PATCH v3 25/35] xfs: Memory allocation profiling fixups 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, 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 X-Rspamd-Queue-Id: A88EF140007 X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: cyy77s54dpokub1fdcst6zwutwrqffip X-HE-Tag: 1707774027-403286 X-HE-Meta: U2FsdGVkX184OMfPrgoB2SI7eKc7j/24j3Birg2nMGnSgWd7mvTqd5uend2moRZfRtryK7ilR3n+4W2nnd9m9PFOi8y3nEGFEj8IaRt+JoTP/4D+jpPBXSQbRpNTaYr4gf6cRNjRgbspQdAcL1sVql+/oXYiaDMyB16jM3KGj8TkqCUhxM0h97KNb6GRIXSLqfdDgv8sTrnlRKjt28tl1JcESTFM9d068bsVzHmqGPQBEuGH2orX9YjvBUZb2pAzvwVhWq9v6C0LI3oesyuZMYJMKRPPUdi1auDV3jGSa5+bRkZazyyGqDbVhV5VcdkNN0W/mjwe2I4721zGvZeFOOp546uiSBfO8IU+929TBxmZL7m6HJLTbdtBu5ONH16O9MksTTBn7YekqXnBe9H6AlGnyMoDAzrmuHUM5x2gUEs4W6dgAphZlOF2XQVulhUaD2ATapaDTxb4g6AbmI/OsbL+u0fCTgawjoDFTBgHbOT/TM6YWHCHdoE46wlCk1KcmP1MJ5oxC2TPiDoh47iiLTcW8C0PADP7/q3dnyK/b+ukVloKQGb6wKdfJ4urzS4gi25HKxOkXDvW61YOh/i4YbVj+hXOtGGp3oEnczkfs2L4qJAJ3phQDvDx3mQ4D59UFPRkVtu7BD8+f8fACr69ZYtEK7gHspYiubaiw+Hekm/keG5QiKt69md4Ro+GR9iPHT0NwL/X7FNXgk6rJIy2/t2rrJHYggTLj8ZjDLmd3rNhlZqMcG8Uvbm24zWQ4kvr9OkJ1O8LNiLvXw505sU3ljSccUFDl4nAM3546S+p7kqrXBP1wH1gldMGQ39iScrvY+SBOzlLXnf+w2JKPIQqInNnalcGD/peZ8380jkVbXyTsDGYDp3zvmCNkqg0F+UIHJedGb+e4N5W6fuSeli30IoTVtc37jJLpsT8/w7ozwxQHNJggd1jdCt9tn+8qe3pJHQc1jsRzRDodMi0rLC c1/KqXsZ QngwosrFDk2FTed3CKW8eW9OlSUqjpfvzaiPhwx4g2DXPU597TtQe6cPh7+NfHoQ2XkqzefUnBDM7ssR7PNmKi1Js56KOyg6/ZVtHt84XiLZN6aNEA37193eWfYiTrbycD52DjppomhE8Q4uwm0/uzxOvzxsZY8yv2m+pksDI+NgkKwVkRx36ucINkml/oob4uk741d5Mlxfo0NyfrIYWt1DHJcXsUrbOT6eMrQr/q8S/WUqyH2cbNqAGPGykh4wEC1qd6lO5SZzOMvgB3Z5BoGqKr7dvMjHmsalK18Fm9sAltv5NaegqJd/rgPKDknDvmfTPWISCFimQELhI3Rp7F7IeJMrVHb0Ja+iyyXJGAtsywTv3Mt0sR1QoKDZ3X6Nt02K3/OeXPqVTO/NWY8axAqrcQNOVSF37vvCWLhQf/2CZK80= 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: From: Kent Overstreet This adds an alloc_hooks() wrapper around kmem_alloc(), so that we can have allocations accounted to the proper callsite. Signed-off-by: Kent Overstreet Signed-off-by: Suren Baghdasaryan --- fs/xfs/kmem.c | 4 ++-- fs/xfs/kmem.h | 10 ++++------ 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/fs/xfs/kmem.c b/fs/xfs/kmem.c index c557a030acfe..9aa57a4e2478 100644 --- a/fs/xfs/kmem.c +++ b/fs/xfs/kmem.c @@ -8,7 +8,7 @@ #include "xfs_trace.h" void * -kmem_alloc(size_t size, xfs_km_flags_t flags) +kmem_alloc_noprof(size_t size, xfs_km_flags_t flags) { int retries = 0; gfp_t lflags = kmem_flags_convert(flags); @@ -17,7 +17,7 @@ kmem_alloc(size_t size, xfs_km_flags_t flags) trace_kmem_alloc(size, flags, _RET_IP_); do { - ptr = kmalloc(size, lflags); + ptr = kmalloc_noprof(size, lflags); if (ptr || (flags & KM_MAYFAIL)) return ptr; if (!(++retries % 100)) diff --git a/fs/xfs/kmem.h b/fs/xfs/kmem.h index b987dc2c6851..c4cf1dc2a7af 100644 --- a/fs/xfs/kmem.h +++ b/fs/xfs/kmem.h @@ -6,6 +6,7 @@ #ifndef __XFS_SUPPORT_KMEM_H__ #define __XFS_SUPPORT_KMEM_H__ +#include #include #include #include @@ -56,18 +57,15 @@ kmem_flags_convert(xfs_km_flags_t flags) return lflags; } -extern void *kmem_alloc(size_t, xfs_km_flags_t); static inline void kmem_free(const void *ptr) { kvfree(ptr); } +extern void *kmem_alloc_noprof(size_t, xfs_km_flags_t); +#define kmem_alloc(...) alloc_hooks(kmem_alloc_noprof(__VA_ARGS__)) -static inline void * -kmem_zalloc(size_t size, xfs_km_flags_t flags) -{ - return kmem_alloc(size, flags | KM_ZERO); -} +#define kmem_zalloc(_size, _flags) kmem_alloc((_size), (_flags) | KM_ZERO) /* * Zone interfaces