From patchwork Wed Sep 4 10:21:21 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13790369 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 64B7ECD4847 for ; Wed, 4 Sep 2024 10:22:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E91CC8D024E; Wed, 4 Sep 2024 06:22:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E423C8D0242; Wed, 4 Sep 2024 06:22:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB8A76B00D2; Wed, 4 Sep 2024 06:22:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id AA4FD6B00CF for ; Wed, 4 Sep 2024 06:22:57 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 65FACA0F94 for ; Wed, 4 Sep 2024 10:22:57 +0000 (UTC) X-FDA: 82526667594.09.0DC9B0A Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf18.hostedemail.com (Postfix) with ESMTP id 9349B1C0004 for ; Wed, 4 Sep 2024 10:22:55 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AEfBh4WZ; spf=pass (imf18.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 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=1725445248; 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=4Z9Ht8DPFxehkbXR69ujslpphgMyAamSjvVjjtyCvnE=; b=IR77H4ZFM8XSiEkhFhx20rKFIoCkwuQ4VFz84H87cDrTU/+dm7b3aCBhJHQWC0TtE2m4gO GZbIx6m4E7Arp5964ywntS5op9FQ9NE8ItcMFWQP1oxAD5droCeaJUHdBGvD2+SWiO30D2 7fRpBBUpHRUrlG+toF8KLKzgVujmi/8= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=AEfBh4WZ; spf=pass (imf18.hostedemail.com: domain of brauner@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=brauner@kernel.org; dmarc=pass (policy=quarantine) header.from=kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725445248; a=rsa-sha256; cv=none; b=y/Fi9H+m7TshNc3MYYjLMihsptysV0Axc4DzQWTZ05KiGAJSF6w5nDEEub4Sy/z4jmrjnx KjA+CuwCZTgqu71OCt/sBqcTdIcxS2Q1xBk00yv3BPvAuDMIVnU+NFTb9zTkc9Gtf9u9g9 jryOz20TdFgA1y1j+rnxpXKHHaW4jGY= Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by dfw.source.kernel.org (Postfix) with ESMTP id 4EF7C5C5706; Wed, 4 Sep 2024 10:22:51 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC9B5C4CECC; Wed, 4 Sep 2024 10:22:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725445374; bh=YjxO66hJ+BVi0bwZydpu1jfLI/x58A7MkM0YNuLTP98=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=AEfBh4WZJ7pNUvjtrYEMp5wXlLriDBDcZYoIuOd4xpupauIsqPzuDzphXZBV4kLV6 TcOZFri2K0HWuchx6mo47Vr+pxy16ovN7pPwNNUVXmGx0I8umtB4a6zQLkYasZBer6 EgvxZrHDnb2A9oa6qB+INgGpn+OS9/RinxZzTzVs8cq0WTzCD8+08jglfGHct+ZnCJ 4iQw5og6J5qluAYydkJv1Us4UU8C7+2Z6LC7mmnDe55ZZgS5PESq77XyMSI0d0jhf4 QX4v/aadFfTR4hnlXSjUP/2yB1sLSbB2OOapeSjVCTVtJ/5ispRbDWwt1+Kuy0mOVV XzTmmcjshI5EQ== From: Christian Brauner Date: Wed, 04 Sep 2024 12:21:21 +0200 Subject: [PATCH v3 16/17] slab: make __kmem_cache_create() static inline MIME-Version: 1.0 Message-Id: <20240904-work-kmem_cache_args-v3-16-05db2179a8c2@kernel.org> References: <20240904-work-kmem_cache_args-v3-0-05db2179a8c2@kernel.org> In-Reply-To: <20240904-work-kmem_cache_args-v3-0-05db2179a8c2@kernel.org> To: Vlastimil Babka , Jens Axboe , Jann Horn , Linus Torvalds , Mike Rapoport Cc: Kees Cook , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, Christian Brauner X-Mailer: b4 0.15-dev-37811 X-Developer-Signature: v=1; a=openpgp-sha256; l=2885; i=brauner@kernel.org; h=from:subject:message-id; bh=YjxO66hJ+BVi0bwZydpu1jfLI/x58A7MkM0YNuLTP98=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdMNm9XjXnZfdPg79/rR6baEe3TpARutzz7eEu2WcW0 a/LpL4zdJSyMIhxMciKKbI4tJuEyy3nqdhslKkBM4eVCWQIAxenAExkHw/D/xKxXKeZEyNXL72z d+5/TQFl7seBn70y714QVhcpi3M61s3w38H/W79TX2P+vgf8U5M2bJ+yfGGtosqbiz4uVt1Cu89 m8AMA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 9349B1C0004 X-Stat-Signature: j37zpjjd54oucpsbaf6t8sqjtuyu4dsp X-Rspam-User: X-HE-Tag: 1725445375-986661 X-HE-Meta: U2FsdGVkX1+wEuYkHqNujq/5UedJ44ySMiqokFPx9IZLU54wLeN6PQ8EZvF967pJsiKLAgcUetSVGHzF8kVGftP9lOqwuV2ZpU2hnydNKPZvchJPnBKaQ2h6ImCvz08/HyNPiEA+p9SiaFrOwfXB8QsAuK9P0x9x/fPfnoLtyrQVrl7YcnbSDzsQ0qJOg+A7MBamIwW/DtffmGw1bHTsiCcTx2cR+rJz84JNdeyvJ6q0acQeFDk1HOj/YvlelWhB5GLXu9n9YMgLH84tGWbo6lVmV/6JlSgdDmRHO1Iz4DVlQLFYV5F2cEGtY2ASbOeBq/HnniFdCjxB7spfobCO9qNL0rgpcwIs2khlwmVrxsONlKVCN4wdCYm95sAw4NSX4EM+y7J6j3Sw4YM13cz2tottwLxfuq9C6/5K2Tz5jgfd3xd+4sxmcjq9/6rNgOhEoWeyDxdKlrCnupjospnXhr/eYDrwKQWoQovwjJHv05lJUn9ppUZZIcSA/ZexB+uzsNbhQ3fRpNndbM97hRXSG9EooGZEvYybYz8r8BUcXhkkTQfbfufhPTL+Fe0W42LFDxnj1vxQlxAzGkVdriyB53WT8+GhflLoEIie37vjk/c3XQjZNU1VKH99TcSwx70Jfa6mkbe0ijyRAAs/g6Zk8fNZUa6eW68/XNcr4MXFvZlGDnFvGjzpK03vuHp/kyjdhEtvlmTP6/jofVZZ0yXYyG52Ca1nCbSMl+cX2NcCDzqDy5UPy20XXJgD9tzpVm1ZP8+EevrYohdS7izD23nIYTL56g8oYSiJMLRtevP32FhAdbE4FINVRSz9QTMmi5ku3Ocnv930FACXeuAib7dvXP6dSV3NU95hOu2/pv52Td+M3U48qMivUObvi2C7XLlvFDCDRJxgRwx0aYtOp4zdYE7TsLM3gx+d8V1ZrnpT769WRhDwr+2aFCXBWnY3P51hOk7UPfLUG7ap4lk0zzQ hK1m9VC8 HPMu0hK3g0ilURqm4t5w+cBgBQ7GoHheoWa0s9dvPQiEVvIenpNFm5WbnrqoErmaV2evpQkKBi2kPSKT1wVE7jTMqYU0UnWi0a/CqpkMn/8skKxw99gxQb+iLHNTGJiB79ZiGhOclkfLuUfmn5Eqz7XH23FVyxC8nxsFdoqzbuORyPILCbz7b9kQrEkCrnKJzLuuTkeW7DwxXAJhOHQU3Jlx3YSCtlDjmiAiREu9hMv9bwr2o6kllFA/yPs8IAaTfW+tGg5Zn+6MTeoCcLN6/P9X6vUP7ugr8WsirnBHzIWunoDv1+0WIDLuq5zhhwUXkJHd36zFGsij0wAmaSMziJoyv74MJUmDmXbwDCoNAlJc31cs= 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 | 13 ++++++++++--- mm/slab_common.c | 38 -------------------------------------- 2 files changed, 10 insertions(+), 41 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index e224a1a9bcbc..70a0f530b89f 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -261,10 +261,17 @@ struct kmem_cache *__kmem_cache_create_args(const char *name, unsigned int object_size, struct kmem_cache_args *args, slab_flags_t flags); +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, + }; -struct kmem_cache *__kmem_cache_create(const char *name, unsigned int size, - unsigned int align, slab_flags_t flags, - void (*ctor)(void *)); + 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; /**