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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4A632C4332F for ; Wed, 23 Nov 2022 17:03:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235309AbiKWRDh (ORCPT ); Wed, 23 Nov 2022 12:03:37 -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 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 | \