From patchwork Wed Sep 4 09:44:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790246 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 DF915CD3431 for ; Wed, 4 Sep 2024 09:45:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57AA36B00B7; Wed, 4 Sep 2024 05:45:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52EEC6B013D; Wed, 4 Sep 2024 05:45:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CBCA6B0143; Wed, 4 Sep 2024 05:45:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 1CAFD6B00B7 for ; Wed, 4 Sep 2024 05:45:15 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id B72E2160F86 for ; Wed, 4 Sep 2024 09:45:14 +0000 (UTC) X-FDA: 82526572548.27.F229D2B Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf05.hostedemail.com (Postfix) with ESMTP id 12FCF100009 for ; Wed, 4 Sep 2024 09:45:11 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VaHKAzf8; spf=pass (imf05.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1725443017; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=L4PDPZ6Hf5Cb3e/YiaP36qNkgjQAGoDFoVNBz6I0ASU=; b=TFXIuOhnjckTUAnA+wNkUVK9wJ2NNCk0U++FUgNJMKAl3YYBpR4W4fnbJMxrCGpWbevMEG anJktTD/fQQMH3zKE8C4kLZr/h9cMI2b9DPWpI0Q1iSZFUP0n5BnixOYLaoEZSNxPdwTHN yEZnvOQ9NCp+2rLUzYZ2XPlICgKEmx8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725443017; a=rsa-sha256; cv=none; b=Os5ZVfPLfEp1d9BmnY8m7zd0VA0bFCP2rGx/XzPOADGxmrZn3AGobD6i45tTuk+YN97msb I6GeXNVWgIeUXYUKzoBgIfkWaq8DX/PqlbjyZmScE+H8oBKPOsVJzBN/D+LVqjf+bSWgfU BrKvu3sX1glxe8DsdzDsd68NO63OkX4= ARC-Authentication-Results: i=1; imf05.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=VaHKAzf8; spf=pass (imf05.hostedemail.com: domain of brauner@kernel.org designates 147.75.193.91 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by nyc.source.kernel.org (Postfix) with ESMTP id 1F506A4357A; Wed, 4 Sep 2024 09:45:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 069EFC4CEC6; Wed, 4 Sep 2024 09:45:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725443111; bh=7VgDRqmx+Ik8PykBNr2uZycRwWkeQDI9rAEBtMLW9VU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VaHKAzf8okC6RU4aD7r1kxRBPo9J7x9RVLEC48KyPy09U+bjdje9w/zcKoVpSmmbZ rOgU3bOVzYctw3312c/F0/WwpAj66C9a38684ytJMa8Hrog29r0d9QYHpW9BwyhoI6 wBYn4U0GzuPu7/YzspnHirYqpZTSZJPvyDf3jtmSHWtLE4htf79AXAUL8212SfeyDK CdyMaELAUHfDxolnpeWUcE7lZVwsPIWXvvFNWdOIbtdVdlxMkMAyAUuX2Hm7XveCkp HwGSzTJ5FS/CUyRmAHZ0BXEwcxCENhJDGtTs9lt/UH76agLfcmxUlodk7rBGTISiW3 h43WhOluJ5m0A== From: Christian Brauner To: Mike Rapoport Cc: Christian Brauner , Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds , linux-mm@kvack.org, linux-fsdevel@vger.kernel.org Subject: [PATCH 18/16] slab: make __kmem_cache_create() static inline Date: Wed, 4 Sep 2024 11:44:13 +0200 Message-ID: <20240904-musizieren-zicken-ee74f5e5c49f@brauner> X-Mailer: git-send-email 2.45.2 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3824; i=brauner@kernel.org; h=from:subject:message-id; bh=7VgDRqmx+Ik8PykBNr2uZycRwWkeQDI9rAEBtMLW9VU=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTd0BFhe/srK/NTn35KxZew11HWU8T2MFgstl+yePoyD Z+Fm55/6ChlYRDjYpAVU2RxaDcJl1vOU7HZKFMDZg4rE8gQBi5OAZjIocOMDA0bbF7+rXCR+m2c PHXVzGNP1csiZIqPtq36dMLy9A0tDWaGf0bR/H6NT3+uS2uxMH774l+o6qNrZgaRf9vepD/c4mo rwQMA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: 12FCF100009 X-Stat-Signature: jbntnhz59a67x3mkmmmots3eb1hm73jm X-Rspamd-Server: rspam09 X-Rspam-User: X-H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JXflwsBl40qcLQ4r5vSIB6EIgZ5aC36cWUyqw4QLuHwf0olQYkafbfMH8Tlrxg407C9WTCcGpfSEu4P9zap/qE9ocXWMV9bOtEA7V0aT+UPNxk2ulwPAa8W6RSXrDCpmz7VCLzFa7c48mdB3PG91RSRNajauCg0yW/X843BdTHUdiZwIjtgsLw0f2VQGO+pS7bmk2vuLBvFpgrsVw840d724fVB4ObLQCmIYhcgv0rshTRk9LtF1m6O/1uvX6y6aOztz5MJ960UBtu08OVY= 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: List-Subscribe: List-Unsubscribe: Make __kmem_cache_create() a static inline function. Signed-off-by: Christian Brauner --- include/linux/slab.h | 39 ++++++++++++++++++++++++++++++++++++--- mm/slab_common.c | 38 -------------------------------------- 2 files changed, 36 insertions(+), 41 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index e224a1a9bcbc..3e16392fa37f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -262,9 +262,42 @@ struct kmem_cache *__kmem_cache_create_args(const char *name, struct kmem_cache_args *args, slab_flags_t flags); -struct kmem_cache *__kmem_cache_create(const char *name, unsigned int size, - unsigned int align, slab_flags_t flags, - void (*ctor)(void *)); +/** + * __kmem_cache_create - Create a cache. + * @name: A string which is used in /proc/slabinfo to identify this cache. + * @size: The size of objects to be created in this cache. + * @align: The required alignment for the objects. + * @flags: SLAB flags + * @ctor: A constructor for the objects. + * + * Cannot be called within a interrupt, but can be interrupted. + * The @ctor is run when new pages are allocated by the cache. + * + * The flags are + * + * %SLAB_POISON - Poison the slab with a known test pattern (a5a5a5a5) + * to catch references to uninitialised memory. + * + * %SLAB_RED_ZONE - Insert `Red` zones around the allocated memory to check + * for buffer overruns. + * + * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware + * cacheline. This can be beneficial if you're counting cycles as closely + * as davem. + * + * Return: a pointer to the cache on success, NULL on failure. + */ +static inline struct kmem_cache * +__kmem_cache_create(const char *name, unsigned int size, unsigned int align, + slab_flags_t flags, void (*ctor)(void *)) +{ + struct kmem_cache_args kmem_args = { + .align = align, + .ctor = ctor, + }; + + return __kmem_cache_create_args(name, size, &kmem_args, flags); +} /** * kmem_cache_create_usercopy - Create a cache with a region suitable diff --git a/mm/slab_common.c b/mm/slab_common.c index 3477a3918afd..30000dcf0736 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -337,44 +337,6 @@ struct kmem_cache *__kmem_cache_create_args(const char *name, } EXPORT_SYMBOL(__kmem_cache_create_args); -/** - * __kmem_cache_create - Create a cache. - * @name: A string which is used in /proc/slabinfo to identify this cache. - * @size: The size of objects to be created in this cache. - * @align: The required alignment for the objects. - * @flags: SLAB flags - * @ctor: A constructor for the objects. - * - * Cannot be called within a interrupt, but can be interrupted. - * The @ctor is run when new pages are allocated by the cache. - * - * The flags are - * - * %SLAB_POISON - Poison the slab with a known test pattern (a5a5a5a5) - * to catch references to uninitialised memory. - * - * %SLAB_RED_ZONE - Insert `Red` zones around the allocated memory to check - * for buffer overruns. - * - * %SLAB_HWCACHE_ALIGN - Align the objects in this cache to a hardware - * cacheline. This can be beneficial if you're counting cycles as closely - * as davem. - * - * Return: a pointer to the cache on success, NULL on failure. - */ -struct kmem_cache *__kmem_cache_create(const char *name, unsigned int size, - unsigned int align, slab_flags_t flags, - void (*ctor)(void *)) -{ - struct kmem_cache_args kmem_args = { - .align = align, - .ctor = ctor, - }; - - return __kmem_cache_create_args(name, size, &kmem_args, flags); -} -EXPORT_SYMBOL(__kmem_cache_create); - static struct kmem_cache *kmem_buckets_cache __ro_after_init; /**