Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp6582553rwb; Tue, 22 Nov 2022 15:49:14 -0800 (PST) X-Google-Smtp-Source: AA0mqf5tn1w4u5u/51ggpdNuOdVPE9ZWaGlTiXAsS9EilYVsNyqJTu1GgQLooKiKN1+/1XOdk+4+ X-Received: by 2002:a62:e711:0:b0:56d:cc74:c261 with SMTP id s17-20020a62e711000000b0056dcc74c261mr6718773pfh.1.1669160954724; Tue, 22 Nov 2022 15:49:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669160954; cv=none; d=google.com; s=arc-20160816; b=JE8x5Cx2oomArukLmtoASHyu55eUPF2621/FvVXki4uQsp7ZKX3Paxs5A3d5P1z0b7 DoVMNkO8h0T+te75iYgmsl3QmyB02rTlqfDhk4B1BZ1wamXX3G1rtDHJItDdRrBhSzDr gAqbMYKgjcjJiFFrjCsSWFlCLDSUW0yqyrSQtIBvkzl73+0quvaSMCm2QvUcZrDjKujt cKkb6jFv4aUmTXQDAsy4HuAIUi+RaZEzpe3hm4nnh6xu/b19Dw2mEfHQqG2Dzecgpa3p wBga6/iqWgNmkONkWT3BJVlyFg1rxav5r2M6PpKBNxTyobw0nxfKTAUiDrU6zKU0OLF7 g4AA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=M1znmgutLrCFjTkMaq+U3jKSr+3xsQnRhI7CvhGKo6U=; b=h3+I0m6TFAwSow4hWTg1P9SoJ1BxtmxzbfVMjFTXoefWUV//KF26dhmDUpI+1veEzl 5JnWjE9Br3xeZIbPf9HPDT2gjHtyCfzcwYUbpE6Ie2bQgF9fDKy748acBrZWuU4DiD9H 6f+B3f8Db124s03SySQcls6DVoTnNDCJz+DWzdzIhns+zZ/irFk4VEo4EeYU+BkGA4y6 dMm/hZEyS4zr9wvai/J98FOAhF/wkum9kxEOHoRGCsLtrwYGWba5H46jBs+iLc06LNjU /u23x7hiDYagjqrlRDczOZeZGB/6/LXv+Vh5tJf6odr96uN/YUn4yMfS6tGXDtWyjDi5 MMBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=uwYg2hnR; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f5-20020a170902ce8500b0018273316ce0si16448683plg.511.2022.11.22.15.49.01; Tue, 22 Nov 2022 15:49:14 -0800 (PST) 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-foundation.org header.s=korg header.b=uwYg2hnR; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234886AbiKVXRX (ORCPT + 89 others); Tue, 22 Nov 2022 18:17:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232645AbiKVXRW (ORCPT ); Tue, 22 Nov 2022 18:17:22 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16004C622A for ; Tue, 22 Nov 2022 15:17:21 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A27DB61935 for ; Tue, 22 Nov 2022 23:17:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 67CF4C433D7; Tue, 22 Nov 2022 23:17:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1669159040; bh=tRxl97TXH1zQb1p9Wgh7fX6XVw3AYxkMguDDWCvykUk=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=uwYg2hnRmQeuHFDhUQ/xftb3p/N3e54S9xwTQE9POjfF3ijxzz1xP8ezx9p5p8oGH +QNT/oa4dEzT4kuLPrmnwiTcevCagRD9ykVqV81X2/V5fkIvkfVD7hsg+0NNTK0B3H ED9/OWBRNjrdy2uGVHa8GZb4jlo2Vqrykl4lUA3c= Date: Tue, 22 Nov 2022 15:17:18 -0800 From: Andrew Morton To: Feng Tang Cc: Vlastimil Babka , Christoph Lameter , "Pekka Enberg" , David Rientjes , "Joonsoo Kim" , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Andrey Konovalov , Dmitry Vyukov , Andrey Ryabinin , Alexander Potapenko , Vincenzo Frascino , , , Subject: Re: [PATCH -next 1/2] mm/slab: add is_kmalloc_cache() helper macro Message-Id: <20221122151718.4f7ffcb656dd7dc0eceb0ad2@linux-foundation.org> In-Reply-To: References: <20221121135024.1655240-1-feng.tang@intel.com> <20221121121938.1f202880ffe6bb18160ef785@linux-foundation.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.33; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham 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, 22 Nov 2022 13:30:19 +0800 Feng Tang wrote: > > If so, that's always best. For (silly) example, consider the behaviour > > of > > > > x = is_kmalloc_cache(s++); > > > > with and without CONFIG_SLOB. > > Another solution I can think of is putting the implementation into > slab_common.c, like the below? I'm not sure that's much of an improvement on the macro :( How about we go with the macro and avoid the expression-with-side-effects gotcha (and the potential CONFIG_SLOB=n unused-variable gotcha)? That would involve evaluating the arg within the CONFIG_SLOB=y version of the macro.