Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7679419rwb; Wed, 23 Nov 2022 09:21:16 -0800 (PST) X-Google-Smtp-Source: AA0mqf5NQYCGukz6Rcc9X97YhkmmbxzxIHUHw8SZwUVcquoroKBee9mfX+efMf1aEfZH8ivp8gqp X-Received: by 2002:a17:902:c946:b0:186:99e3:c079 with SMTP id i6-20020a170902c94600b0018699e3c079mr9746994pla.149.1669224076503; Wed, 23 Nov 2022 09:21:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669224076; cv=none; d=google.com; s=arc-20160816; b=QkdeLYNH0XP+v8nCBKymp6PeoxrP2BotN04eZgt0c9yyX9j9wXvaOTcXrEUBY8koFo TOtcpB5SiKycJ8IeglFK0nygHeKtLjBWbwPb4vBCIc/J+too1ujBh1L1qB9WurYkDzJe +HDC96uypeoaloqgRfd6n8ql/4dQQgObnRq8KeSWi3Ew8vBtgOZ1mKuJMHCcpua3iGhm dlr9ZvpkqKCuQpXIDMjbTEcmnB0VedkYa41qCAlMEeMrYDenvPB9t7/CVwbatRkmabUH gZVNYdMLSb3Q3ZRCEaXtlzzMvh5BypgiMNEF5ycqHmWywoOrv/S9H8FKkktq8RSHAQAF 2QTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature:dkim-signature; bh=QOTqESa3U7W1bqo4V15GNCzXDu459rGsEt2ugIrp2oo=; b=EMwfoK1OvUe3hGYfk09q/6NiYKtUOjNh1eS5iyMKjz20MDtn6P5e06Yv0RbSQR3P7u 3PdfnNywtOvGF1m1XNN757Eq1y1CerQ1c73y6/4KrVYo3YEOTxkt3uKg847svIMbucUE lYLVBRTRAhB1cvv6LpYAhuVqlEtYQOWhn88vmPTMEbn/PiJ1a+FhQoqIme1ZKbfcDDQr 83ziYuRhlPBKL6IbXqj1A3zBa8+w52ye2UibRjHa50BxjKOjbh4L3l9S/zDqD5YOVU7y L+OSO9D0oGDIsDj0Ae/x4nh1UOxUXnLP2kP/DohYdAUYm268ybfEKjUsKdMfS9bgbxsW TIzA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.cz header.s=susede2_rsa header.b=P7YAkbJd; dkim=neutral (no key) header.i=@suse.cz header.b=ct7u2HKk; 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 f7-20020a056a00238700b0056e69d7f44asi18390210pfc.113.2022.11.23.09.21.04; Wed, 23 Nov 2022 09:21:16 -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=@suse.cz header.s=susede2_rsa header.b=P7YAkbJd; dkim=neutral (no key) header.i=@suse.cz header.b=ct7u2HKk; 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 S236541AbiKWRDf (ORCPT + 88 others); Wed, 23 Nov 2022 12:03:35 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237983AbiKWRDc (ORCPT ); Wed, 23 Nov 2022 12:03:32 -0500 Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A20994A73 for ; Wed, 23 Nov 2022 09:03:27 -0800 (PST) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out1.suse.de (Postfix) with ESMTPS id AD7E921A20; Wed, 23 Nov 2022 17:03:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_rsa; t=1669223006; h=from:from:reply-to: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=QOTqESa3U7W1bqo4V15GNCzXDu459rGsEt2ugIrp2oo=; b=P7YAkbJdM0MPjlher8/nZaZlAvbB5SpS4NQTqUjziAAGNcKgQZy61aewO4JVcnBIq0LeiK 2sq34Wvrg6WL1ZlOKiqIYDalzhJ9FYZnKnb1LQcW8Mts+ZyjHFUnphlpInf9bwp3rOfQSX CsPvaoBnhAR4SXwUDZsI0D7st4RpSPU= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.cz; s=susede2_ed25519; t=1669223006; h=from:from:reply-to: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=QOTqESa3U7W1bqo4V15GNCzXDu459rGsEt2ugIrp2oo=; b=ct7u2HKkDhEc2h4wRrne/VdJiY9EG+3LNhuq2lQ5tMb6YwBYdcdf+9mX1U4cPUaWZ+HoX7 YkC0t/bht/r8hzCw== Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id 6EDA213AE7; Wed, 23 Nov 2022 17:03:26 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id PkBhGl5SfmOscAAAMHmgww (envelope-from ); Wed, 23 Nov 2022 17:03:26 +0000 Message-ID: Date: Wed, 23 Nov 2022 18:03:26 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH v2 -next 1/2] mm/slb: add is_kmalloc_cache() helper function Content-Language: en-US To: Feng Tang , Andrew Morton , 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 Cc: linux-mm@kvack.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org References: <20221123123159.2325763-1-feng.tang@intel.com> From: Vlastimil Babka In-Reply-To: <20221123123159.2325763-1-feng.tang@intel.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, 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 Subject should say mm/slab On 11/23/22 13:31, Feng Tang wrote: > commit 6edf2576a6cc ("mm/slub: enable debugging memory wasting of > kmalloc") introduces 'SLAB_KMALLOC' bit specifying whether a > kmem_cache is a kmalloc cache for slab/slub (slob doesn't have > dedicated kmalloc caches). > > Add a helper inline function for other components like kasan to > simplify code. > > Signed-off-by: Feng Tang Acked-by: Vlastimil Babka Patch 2 seems to depend on patches in Andrew's tree so it's simpler if he takes both of these too. Thanks, Vlastimil > --- > changlog: > > since v1: > * don't use macro for the helper (Andrew Morton) > * place the inline function in mm/slb.h to solve data structure > definition issue (Vlastimil Babka) > > mm/slab.h | 8 ++++++++ > 1 file changed, 8 insertions(+) > > diff --git a/mm/slab.h b/mm/slab.h > index e3b3231af742..0d72fd62751a 100644 > --- a/mm/slab.h > +++ b/mm/slab.h > @@ -325,6 +325,14 @@ static inline slab_flags_t kmem_cache_flags(unsigned int object_size, > } > #endif > > +static inline bool is_kmalloc_cache(struct kmem_cache *s) > +{ > +#ifndef CONFIG_SLOB > + return (s->flags & SLAB_KMALLOC); > +#else > + return false; > +#endif > +} > > /* Legal flag mask for kmem_cache_create(), for various configurations */ > #define SLAB_CORE_FLAGS (SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA | \