From mboxrd@z Thu Jan 1 00:00:00 1970 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 47521C433FE for ; Tue, 22 Nov 2022 23:17:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B78696B0072; Tue, 22 Nov 2022 18:17:23 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id B28946B0073; Tue, 22 Nov 2022 18:17:23 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A17BA6B0074; Tue, 22 Nov 2022 18:17:23 -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 9348F6B0072 for ; Tue, 22 Nov 2022 18:17:23 -0500 (EST) Received: from smtpin12.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 623D240AE7 for ; Tue, 22 Nov 2022 23:17:23 +0000 (UTC) X-FDA: 80162641566.12.12ADA41 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by imf08.hostedemail.com (Postfix) with ESMTP id BEB3416000B for ; Tue, 22 Nov 2022 23:17:22 +0000 (UTC) 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 ams.source.kernel.org (Postfix) with ESMTPS id 38754B81D4B; Tue, 22 Nov 2022 23:17:21 +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 ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uwYg2hnR; spf=pass (imf08.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1669159043; a=rsa-sha256; cv=none; b=epMTYnuIcqf6qOstm0K09vpo60EU3vk9VyQQ0u3lDu3CjyeanaTsbx3yF+RkNzS/kDfMxG hVXzAo6eFeBYqQc8CTGdi4GOHKEoZkSp0bY+5sPv81J89RPP8t2JXLzqHjbSJ5+6Ws0T51 IUCROGbfCdEXyqouNc8NF2Ok3uCwW+w= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1669159043; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=M1znmgutLrCFjTkMaq+U3jKSr+3xsQnRhI7CvhGKo6U=; b=uQUMBBDeJIpexD5qoWOL4bsa6+OAsLjMg/FV1w7Rjf44GB3PDs4TuDoEVvoQtwid4Jqgmk rj8BS7VvxtgmGk44g9ZxiIT4DXZ0hT70wvPNyD/MwF8V1Vw5VndBbGRRsDuXMPWfSZCSp1 8/UYd2hxg+nkcuV70O7e44RK1I4sHEA= X-Stat-Signature: 6dqbpqy4ftsc9uypf6fsn61py6s56ht6 X-Rspamd-Server: rspam08 X-Rspam-User: Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=uwYg2hnR; spf=pass (imf08.hostedemail.com: domain of akpm@linux-foundation.org designates 145.40.68.75 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-Rspamd-Queue-Id: BEB3416000B X-HE-Tag: 1669159042-915979 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: 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.