Received: by 2002:a05:7412:3b8b:b0:fc:a2b0:25d7 with SMTP id nd11csp2705482rdb; Mon, 12 Feb 2024 13:49:56 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXP9Vhe5qoRsudbLUDZweP70qZZopWVp/HK+XaGFn41//JKn2g/Aefx9CxiEhlP/Hs2uWUZQBGMVGokJQWGw50FRL2ORDg51pz68yfvGw== X-Google-Smtp-Source: AGHT+IHH7feYacC2zpaL48XOjOoDptvxBs6WP0ats9HO3vhIkorphnaoq3T9vK+k/Blcp5ucLGG+ X-Received: by 2002:aa7:d1c8:0:b0:560:3a3:0 with SMTP id g8-20020aa7d1c8000000b0056003a30000mr6492474edp.30.1707774596680; Mon, 12 Feb 2024 13:49:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707774596; cv=pass; d=google.com; s=arc-20160816; b=ACOzxn3fT8kYOoq0pM2GQon3l99sKXj+naG7GmEKU68g/oM2JNvmAZy32EgGNsYl3k JqFAb7i41DjtjKECh4veGMntFYjkF3bShm0EUTfZ8mCtX0bW5GflkRCUnuovUAoG16ky DYoHMX0SygTzcLvj8KMt7fa58fdJclxm44OQYI0tW5a8Xl2BHaNp0Oh8BQjRRbKlbXON prYOwJt/ZRhXw9lUG0zhLRwVMBDvE/Jl0T9xCo1yKD/pRwMbamzXYRU0/DkdsPjxVck3 gx8s7Y9yVYvtVk1hXbnYIh091XWefR/sjJn2/CHLMs2isqXDHPCmqko5lRWhXwROgwE6 aZ7Q== 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=Uyzb7E9FIhn/mbh3tSg2FbzBy8bNHcnwrWfMf2QZXg0=; fh=8pdFJmJdwnUiFHOVzMquTt5mDXfCN6/p/bIK/0ofOgQ=; b=ztLg3CFgouTpnHW1QsPCUqSATAZ+8DRrCiXBzs6EjYRp0n4zXHd9CqYPQkrSHgI5FK 2E0kCPC0p2f55jLg7fVZfiQWz4k8rsON5Cc2Y6Q827Ds6khxx+wgMGC9N2sIQbTtEjW/ 6/LmS0HXdads0QAgaICSz06HKOnw+d1stN3R+w0fZ2WAPJ7/YBMw699oPWn2TXoyLxZp MKyZVGDjgSlR/FZQbFG4gGAUPI+sUOcn1i3K2fdkns6T4UYm78tA89BeA5Ulz1kXpsVJ VXqCzkl2UYqizfOXyks5IJryKhJ7B+hK5U8HuZRK+2BU/LGARhG5nrwG2QSk2Wn/B/x+ RwQg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FNho1vl3; 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-62431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62431-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com X-Forwarded-Encrypted: i=2; AJvYcCVv+INzqcMw5cqc3TaJpGocUqB6azU8Y/2DDTwEhmbuRqjL0czehxduPUU18/KlH+FqqgVdT5Wgl2gPfuJJPZiL9seEmUjBCb+7N1XUag== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r21-20020aa7d595000000b0056164e44de1si2990948edq.660.2024.02.12.13.49.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Feb 2024 13:49:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-62431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20230601 header.b=FNho1vl3; 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-62431-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-62431-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 6B8831F2329F for ; Mon, 12 Feb 2024 21:49:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4ED425A78C; Mon, 12 Feb 2024 21:40:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="FNho1vl3" Received: from mail-yw1-f202.google.com (mail-yw1-f202.google.com [209.85.128.202]) (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 9DF2758AAC for ; Mon, 12 Feb 2024 21:40:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707774029; cv=none; b=YkddTI9yF+Tz+ol1WpzRLJmumaqAMGVyfzQy9MMzYF2D9RIefAK93rJ1cG7PBxYaA8c1v0HB57mjkgGwANyi+id1FHaFQLyVRbRd2+fjzxVR8eKo19QIrXOlJziPuKSd5pW2EWbfoAyjpeP2jQySMtlTZ4lakOlq+QDJip6TCG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707774029; c=relaxed/simple; bh=SPQ6Ysfd7WnLLii6ApAHVobNpCAxJwmzP4EGGARuO/M=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=QRD7SFiMY4YmmOMD9HtaNrtiUxZwqWZwiVLwNk3VmCucnEKH36DDZFe2DZGt8nWLDbVSQulct9q4F79IjopY1tg3m+35Z1Hnm889mWFVEfv/vArxjEn0DzOAHj0+DKtnz1p1OyGZL+fnw6XUnpNAdZ1+07pP7gUQAmi25npCZuU= 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=FNho1vl3; arc=none smtp.client-ip=209.85.128.202 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-f202.google.com with SMTP id 00721157ae682-6047a047f58so66780127b3.3 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=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=Uyzb7E9FIhn/mbh3tSg2FbzBy8bNHcnwrWfMf2QZXg0=; b=FNho1vl3tt9J+6Doa5B0s+MpcIxnRkqDjVGbtulbmBq+KlAel0ZRPSDKK5WK6m2YUI v5mbXUCJL7cHOZPaO/Z/isl9yYFvC0fQ6Ba54wk2zZNnB20JGQEvjPJbCNPNEumi2G2v TCVSgWGroVKF+trDAcs9bCaBGiARj+xv8V2Ew9bCpZxMRNl+fd1OjFzNml5UAoxcQlYx YwMcLllMnvgJbNXfJkJ50caD3DDtPwuWkYTKXTDfLUadKu4W5dxBcw1V0hsKxVqpBnIo FLqwwV8Z4Ut/Q1n96ll3obaZBsRTc22a4yBF9F1JHTQ32EnjRNdsWrXMymkJZ60bzQo/ 2Zlg== 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=ZNw8atSAHHGRuyoEw69nRY4zSvhM5hWBUirlHljWPmTwNh8NoSBvbkTFscWp6B3V7+ PnevBAgEV/37+gZpKgB+AidcCuc/9UzB7g/1P+kaES2orFxc98fEaWvc3UxT6mBh5dBD V0a8BtZYOde11LZI1rK/eE78afQ1A1dQYP3RWs/9w1QYQ47ITSOdSPflvVfMw/g3TeSX rcbwzyFsZYyyb8DvcRzaAn47hHDyNKiSso2NPgadrBZtu5zAjLQeoZDZwpo2tT5pd9AB WgxTFKOaLCRjnHZtPLbJ7XfNR4LnMH4gChsl5W3p1elW6YWJ/jTAGzxG5Tk3AFUxhgfH TLGg== X-Forwarded-Encrypted: i=1; AJvYcCXobTsRUN9NBXvVq5YSXs66Qy9PJA5ush5l3o/JKRsaAKd0lS9jIf0HAheBb/LNTkTEgX8pyyFUJRNvFUQ5ySDuBLKxPOfyrICFPG9o X-Gm-Message-State: AOJu0YxoeaBn5FVqWIk/yBHOyNRjTRqfq52cT1Zj62XTPaDr3042kO/2 5vYMogpaAVh3m/ZXz+PjWFLTqgA0r3iaxcAXYgSrN/PFqxDyMJk6LQXj0FQ8dBEvrhtgFXuoszo Hkw== 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: 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 Content-Type: text/plain; charset="UTF-8" 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 -- 2.43.0.687.g38aa6559b0-goog