Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp7333347rwr; Tue, 2 May 2023 13:03:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ41x8rXpr18z9b88T+ZrEuOW+w6n0aJUagxGxHSQsTKw4W1q3i4XfuWrCLO9MP/UybrEPx/ X-Received: by 2002:a05:6a00:1885:b0:63d:6984:7a93 with SMTP id x5-20020a056a00188500b0063d69847a93mr25985431pfh.30.1683057818395; Tue, 02 May 2023 13:03:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683057818; cv=none; d=google.com; s=arc-20160816; b=XAtYfHo5zSMNq88ZGGYzg6rNKNvc5yaXgxERJ4dteNMg59Dh+pRJcdjnFoIvhM5QxT W3KCxX7BN0lCVDfyXUezFcoUHLZmb+yzxekUsohaGDnyAM+QLg5ZQ+//JywKh+oGQT6n eVLMrD6z94J50GRus+molWCgKZ+fmao2Er7dAtqxoAcdVzauW3fH47yFNRLeeRLPqosh MLYM4CAeVrTDXwdjwzATA4NlhHRwcqvdOGut1hKfJKvFySPxfqhV+cvFixOjQn3e9PWZ 0WpLGq03p3eii9F21/BPz/S1z5V/gHt4d3MeqbfP+35YYyU+hOm0OAoyeG3h9cx8cmYY fzMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:dkim-signature:date; bh=bbTqJ6Cy48RWo6Tz/tI7JJZLpQOgd1GnXsK6J+pb2Po=; b=MMlxEZVHh+fRD1jGbAaJkq9spdThxUbwxJJLGbIUt97MKwpiBQ0/EANRUd9ivaEjN5 SdKDqubz89aG3qkA4u1mWPcxBd9b/ju5qfqI32WFknypFJbic14VOPmPwhxeKdvapX6L OJEtuo3pW+EX3Dms+e0fdpfINbBWIX0osDKpE8Y9Qja6GysbHcPOPaM5WKyHwXcfr6Nl HP5rGaCWQjdiQFdOKGbVUAG/RZhGnClNQ3yn06NpFuQKWClCF+NtVgy65qww+4veBEf2 5dsixgmucfLEIr/JKUkxkA+61ffNDIKl+RUF+fa8K6eLExqfi4F1VVx+M8AvCDv0duDv 9HRw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TPEXvTAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t6-20020a625f06000000b006251fb701a6si30924895pfb.285.2023.05.02.13.03.09; Tue, 02 May 2023 13:03:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=TPEXvTAZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229737AbjEBT6L (ORCPT + 99 others); Tue, 2 May 2023 15:58:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34508 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229696AbjEBT6J (ORCPT ); Tue, 2 May 2023 15:58:09 -0400 Received: from out-58.mta1.migadu.com (out-58.mta1.migadu.com [95.215.58.58]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 96CD21BF9 for ; Tue, 2 May 2023 12:58:06 -0700 (PDT) Date: Tue, 2 May 2023 15:57:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1683057484; h=from:from: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:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bbTqJ6Cy48RWo6Tz/tI7JJZLpQOgd1GnXsK6J+pb2Po=; b=TPEXvTAZj7eMMlezn0mxuUI2XEAYSmuur8j15Vhz2aAoEuxaC8gwe/DdLVCUdzI8I+L6aU DEG5XTP5rhYFuMy34wKLVWK/nyN2iMJiF2WhtVwQS5E54+cSGLx6PlY24qgxqRCabxvnfl 6yoheYQVL8RgpgGG5HowroFYWwjIS0M= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Kent Overstreet To: Petr =?utf-8?B?VGVzYcWZw61r?= Cc: Suren Baghdasaryan , akpm@linux-foundation.org, 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, ldufour@linux.ibm.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, 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, Alexander Viro Subject: Re: [PATCH 03/40] fs: Convert alloc_inode_sb() to a macro Message-ID: References: <20230501165450.15352-1-surenb@google.com> <20230501165450.15352-4-surenb@google.com> <20230502143530.1586e287@meshulam.tesarici.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20230502143530.1586e287@meshulam.tesarici.cz> X-Migadu-Flow: FLOW_OUT X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 02, 2023 at 02:35:30PM +0200, Petr Tesařík wrote: > On Mon, 1 May 2023 09:54:13 -0700 > Suren Baghdasaryan wrote: > > > From: Kent Overstreet > > > > We're introducing alloc tagging, which tracks memory allocations by > > callsite. Converting alloc_inode_sb() to a macro means allocations will > > be tracked by its caller, which is a bit more useful. > > > > Signed-off-by: Kent Overstreet > > Signed-off-by: Suren Baghdasaryan > > Cc: Alexander Viro > > --- > > include/linux/fs.h | 6 +----- > > 1 file changed, 1 insertion(+), 5 deletions(-) > > > > diff --git a/include/linux/fs.h b/include/linux/fs.h > > index 21a981680856..4905ce14db0b 100644 > > --- a/include/linux/fs.h > > +++ b/include/linux/fs.h > > @@ -2699,11 +2699,7 @@ int setattr_should_drop_sgid(struct mnt_idmap *idmap, > > * This must be used for allocating filesystems specific inodes to set > > * up the inode reclaim context correctly. > > */ > > -static inline void * > > -alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, gfp_t gfp) > > -{ > > - return kmem_cache_alloc_lru(cache, &sb->s_inode_lru, gfp); > > -} > > +#define alloc_inode_sb(_sb, _cache, _gfp) kmem_cache_alloc_lru(_cache, &_sb->s_inode_lru, _gfp) > > Honestly, I don't like this change. In general, pre-processor macros > are ugly and error-prone. It's a one line macro, it's fine. > Besides, it works for you only because __kmem_cache_alloc_lru() is > declared __always_inline (unless CONFIG_SLUB_TINY is defined, but then > you probably don't want the tracking either). In any case, it's going > to be difficult for people to understand why and how this works. I think you must be confused. kmem_cache_alloc_lru() is a macro, and we need that macro to be expanded at the alloc_inode_sb() callsite. It's got nothing to do with whether or not __kmem_cache_alloc_lru() is inline or not. > If the actual caller of alloc_inode_sb() is needed, I'd rather add it > as a parameter and pass down _RET_IP_ explicitly here. That approach was considered, but adding an ip parameter to every memory allocation function would've been far more churn.