From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f181.google.com (mail-yb1-f181.google.com [209.85.219.181]) (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 AA6F31420C9 for ; Wed, 14 Feb 2024 22:36:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707950181; cv=none; b=XFIeQ1ts13WA7CrVFRoxg8kinoB1+tRaIBqJqQ37veUY9sY2k2dPCyoTLfMAbZwIpCTuH6LO4c4jv0PcS0cBO7l23CXTqmrURktCszLq8pMn6EFo/+mg+PpqLVkIhpgf7aHXYA9JYdxC7PlEmz1Dca48VB8r7UdVILs88Fj9go0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707950181; c=relaxed/simple; bh=C0crMXEshWXmvClKWRf7fOFqj/1UG01MNn2e/g61qyA=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=bEmVNRmbRrMTanbJBKqRXrcdLA/zkHaLOWCtaRRCpk8HSgEzFD7NzbtosWg69DSQvS9mwIu5VTyJzM09hOdBA/tkHMkNgpzbiHuGcdQQhAt4zO+3I/z0cZon/Yw4qXkI5ns4eMjHHPHXRemXTuBFMSs6nGRLyLury+e2gjsb4MI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=O2yMsy/4; arc=none smtp.client-ip=209.85.219.181 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=google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="O2yMsy/4" Received: by mail-yb1-f181.google.com with SMTP id 3f1490d57ef6-dc6d8bd612dso205199276.1 for ; Wed, 14 Feb 2024 14:36:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1707950178; x=1708554978; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=mIZ+3Vimc+Fu9uNEqwRF3MpLhrYbsxAAnrlrt3WNttw=; b=O2yMsy/4oK8Y+fycjp+dTg7a95J3x8uffn5QQr/GODzExUn+5G+F1syIYtUOfWJzqr VWnifaveFBOThJy2sKyI/Uy6uSfYCaWQ8rs+vnJ6uTAaToe3OeN7Ck4g35cRmc7SULgW laJ2nuz+VS51bFFnqHVE7welFFlu4ndy4JVcGUEPx9hVfuSNHt7B6bMWePu/VzHNqW52 CA42MpX0muLR6BbAaA7ZcJvUVwHp9ISH7RboIY2VBPjOK9ogFCKNPaPmrRsHKi8s4PUD Ih2VJvDYzSrud5HsdsKn4sU6PKEp9zXsfcrtDRXggHej6O7KHmSUtU8JvMr7ho9EnsKS a7mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1707950178; x=1708554978; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=mIZ+3Vimc+Fu9uNEqwRF3MpLhrYbsxAAnrlrt3WNttw=; b=hw0Bx8+smZRGJpxV8zNf402kHz9WCUsR2yePArxN6r1uPNA3OiKWthnmsqa7xd4mUH Cv+n+AMqk5IOFunFfU+jikoqrRz9invaGdXmSUUsmasVTNCKlXh+KbqzuVmrQNdGxEzn WxJzgWdVKC7yuUbySou5IbWiPCnMMxs4j4v3KtjkmCIkk0aNRmSBlIl7f1cdTlqxlZcv mJC9b7H/QIIWtVo/PO+RAE1vcGRnvK+7yjbriWoqZvR4wXL1rkNcWJzJgLU4LlPpai+E J3+XG8jcwe/S2vmvvyEoCRtTNwDfqW1CXt6Srfy83ZHyVgNbwGWvzBIlJj/Hy/NtkJMe RIyw== X-Forwarded-Encrypted: i=1; AJvYcCWyotQqxF+J/AvUPoU7VdmIViInoADUTh4pav9rxtixSY/FCEc39IagKGoHmrbn/uOao0umDnPi3hZzZn49xFmAKc9oRavS6wkIQw== X-Gm-Message-State: AOJu0YysVxipme/SQQMGsupj0Ae7J66Zw8zcx+xv/IzYdQomp/xcsoXn b0vPc3v9tm/s2gKaMIPs+GtOg2Tg81zFl5dbdnqC1qYcNgfi5OV6cjn+qxoK1ZtATAeO+faMuim KxKlTng1hNRc8mezobkuh5x7DrvZCA7uEr1AA X-Google-Smtp-Source: AGHT+IFGMo5QMzgB4haA8j4PHefAYH0QGMXhhajKI9bA2/lcKpgWtoNuuV25DDWG2rPEqNS3u8mi+lX2wk/W+0Ufusg= X-Received: by 2002:a25:208:0:b0:dc6:9c4f:9e85 with SMTP id 8-20020a250208000000b00dc69c4f9e85mr3483617ybc.49.1707950178324; Wed, 14 Feb 2024 14:36:18 -0800 (PST) Precedence: bulk X-Mailing-List: linux-arch@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240212213922.783301-1-surenb@google.com> <20240212213922.783301-26-surenb@google.com> In-Reply-To: From: Suren Baghdasaryan Date: Wed, 14 Feb 2024 14:36:06 -0800 Message-ID: Subject: Re: [PATCH v3 25/35] xfs: Memory allocation profiling fixups To: Dave Chinner Cc: akpm@linux-foundation.org, 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, 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" Content-Transfer-Encoding: quoted-printable On Wed, Feb 14, 2024 at 2:22=E2=80=AFPM Dave Chinner = wrote: > > On Mon, Feb 12, 2024 at 01:39:11PM -0800, Suren Baghdasaryan wrote: > > 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 =3D 0; > > gfp_t lflags =3D 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 =3D kmalloc(size, lflags); > > + ptr =3D 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_no= prof(__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 > > These changes can be dropped - the fs/xfs/kmem.[ch] stuff is now > gone in linux-xfs/for-next. Thanks for the note. Will drop in the next submission. > > -Dave. > -- > Dave Chinner > david@fromorbit.com