From patchwork Thu Sep 5 07:56:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 13791894 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 DC088CD4F5B for ; Thu, 5 Sep 2024 07:58:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7164B6B010A; Thu, 5 Sep 2024 03:58:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6A2986B010B; Thu, 5 Sep 2024 03:58:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 283986B010C; Thu, 5 Sep 2024 03:58:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 093E96B010A for ; Thu, 5 Sep 2024 03:58:02 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id CBF06AB0A9 for ; Thu, 5 Sep 2024 07:58:01 +0000 (UTC) X-FDA: 82529931162.09.2CCED9C Received: from nyc.source.kernel.org (nyc.source.kernel.org [147.75.193.91]) by imf23.hostedemail.com (Postfix) with ESMTP id 27609140013 for ; Thu, 5 Sep 2024 07:57:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Cm9Sd2Di; spf=pass (imf23.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=1725522984; 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=+TLzy+xdOwmwHtnmkVNYR0Tbt1erdt/6SiK9MLuoqrs=; b=0Sjuq12hIirrZP1bmmNHUZpzrEHd5fdYT7WiqSAfYaxNBtCiVCqa/DraI7r/9bPGISINdP h2T7xVcetOp5EeU1otJ43V5N5WSiZHPT4rqhKi6q5kZsMf1MPFWzVX6Jkg5yGDvAvF5PSj X/D2/WtU5QyjNQoKknY62LBqxWHUchs= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1725522984; a=rsa-sha256; cv=none; b=GwrCM1SseJy/MOzun6LwfAb6YK/OZjgVphOIBCyewj+316+fsHSA1fhkQq2WfzAgPwMKQx a2AUL7eIwtRtbyE8g8jc9DigsNfrbUmYI4Rt6Nozudr5NNppSmP1jKFNkIuPfY/GfGievg rUrh6h4/z2xdqA9NlCFgyPob2+P40Hc= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=Cm9Sd2Di; spf=pass (imf23.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 35E96A44378; Thu, 5 Sep 2024 07:57:52 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9920BC4CEC4; Thu, 5 Sep 2024 07:57:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1725523079; bh=c9WyXR3UutI5YuOZDzru6g9A7doJ0To6Z/yCENECssA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=Cm9Sd2DiCmnN0M4VfGZk7Ktm5XhL7pstZXSAV2/tXTU0vjUTxs17RLf9hjLGtOvjr aJuzjiNbaXAw0LLzOGR4Kkckwn0fnE09r3ZmDZ/kHmLqzpeCr1buh5ukhX4ArhnWrg PUQIGMuRq8rnFXLrp2CEa8HmM52xfYv66EJKiCyh1q3wy8/FOiQXi7vs9Tah2zsODe CosxMcX8TUjUa8lTOHalsD5psOIeXV3QgYlKjByOBrBU7LF4R/gPR00gARG+pwrohn DDHKwylYuoaxckibZsHQvhMGDCp7+cnBl1N65RZblKCkMhS8juxVlCdR9cqGkOs/5Y AZuImLS0sp9dg== From: Christian Brauner Date: Thu, 05 Sep 2024 09:56:57 +0200 Subject: [PATCH v4 14/17] slab: remove kmem_cache_create_rcu() MIME-Version: 1.0 Message-Id: <20240905-work-kmem_cache_args-v4-14-ed45d5380679@kernel.org> References: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@kernel.org> In-Reply-To: <20240905-work-kmem_cache_args-v4-0-ed45d5380679@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=3200; i=brauner@kernel.org; h=from:subject:message-id; bh=c9WyXR3UutI5YuOZDzru6g9A7doJ0To6Z/yCENECssA=; b=owGbwMvMwCU28Zj0gdSKO4sYT6slMaTdTPG+F8+58dldnj9qzNtvnnm8aYfemt7vfz66bb2oG iHMce3Hwo5SFgYxLgZZMUUWh3aTcLnlPBWbjTI1YOawMoEMYeDiFICJxGsy/M/5INce7OTJUvjF Z33SiZQN9YV1DbtmHLIulz2wyily3XOGf/aFNUbt6q4vZqyd+vP26xvmEqsurtf8Lms8z/OtwNX yg+wA X-Developer-Key: i=brauner@kernel.org; a=openpgp; fpr=4880B8C9BD0E5106FC070F4F7B3C391EFEA93624 X-Rspamd-Queue-Id: 27609140013 X-Stat-Signature: rffssg9iuj6xzi596343ks4uexu4a9ye X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1725523079-376619 X-HE-Meta: U2FsdGVkX1+bbQ/DkpbfW/G8RIEVfHDvRcPQVATlU6HbPS0t2uP3DxFJ8saBjk/MkokVDDGnLwW8RUnRtmF1vuxxKk9UuGjGbyAbQOUoB6gd7g6BXmZU0/89QmvGKKRca6A7o7fjk8oiCnZgVraUwCcDpqbBTOQAJ/FtKSKY+9j7o5oVXuss1WLyN7dRbooatbIJDha0I8gSLFc43ZX0BaeLxEus/uXTw8FM/S4F1kf4yCIUpNKM6YPx4dDrFw8CuqgdyT2PyI3GJ7uxDWDsH1iYwfZDBHfzfOhgD8KSNnXLYyPrl4uUL+bE1IMwZp/H+Kbh6iA9OTY4M8CTkQPNOChzxSfv2XlIhok9B7oUqgtRUEk891onWiBrivyN5WV5CEKeYkkmEKsEBkL9xlnJn3GObhS288le3QQLO74jWQ0wiR61ulBWyVqTt1Q5yYmrurjtrV0kvE/KijFWDx2LG8SYXqhZ5ksmbQL21tvss4xpo5e19NpZLYmodmBLnwohnCKn9qGqj5UrettebDaJmc7PnAuoj7c3rgGmlajSW8Vuu+g0f/RQ1cYcTZjyy4zw2yO7digmk3WmML7jo8Ob0i+TJ9XVa8g5Fh/bR89iR8tUd8uG3VFVaY12X3iC+K/dFcO5AYAH+0EEWmuootm2Vo0YEp99m07fQQWqWyuHQvqztp3GiA6tYoItv1kGLKkcvvw+aImWvz0/0/ML4uhJkCFdHp0SI5PNo2kWnSGnX2fS+F2ecAhWO1/HJsm9oZDCbGwZH7wSGoSEHKUhJkxmy7rOOXaD0VlzFu9CYXOZ0SOU/2oudzl1CSys+S9z1RBk6rnWW+82Fd9KsqF80Acde9X8E2zJOh3+Q8ETSvG8Lti9AcS6eJIjczSTXa/OlGuQkqHFrpeTi0bZCuW2t80hjDqoUJL3ek899CeYfdAfzP+rpuWZA+O3TOKE2YeYGzu1aMWl2GygCz+Ucz8Gyrb Oag3qsxG no7/xXDKC7yy1s7pk1vScHgeDn3mjeHeAte5YJjUyv2C9ZdpN8ffeET6wbADl5lOrRIthzCZRUiwvowPmHC+XcM/czMYigamKPvREn62y09xvn88jJtZY6MAo8VQVI2x+oNcpjzjIw7qNrmCBfv8o0HolyAdNbhjqsIDFVqTRRAn+GsqvQxqiXEEamdrbSQuodabKjfu8Jn4T6KsBRE0AMgH4+S6YX8OPOiLkeTroMMGwPf/NOd90Wu6iT+n+hAYRksQXQvhDAhVPGBPsk5xnmOeALGcMyInjEElz1iMUtS91Why9L/HT7oL4IU4NNxsRW0CcVreoq496IslSiB1J3Xxs47f8r9NwDrunHXDP7AdbNJLxiMQqbY+RP/vfghxAHigiup+ei1GJVjM= 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: Now that we have ported all users of kmem_cache_create_rcu() to struct kmem_cache_args the function is unused and can be removed. Reviewed-by: Kees Cook Reviewed-by: Jens Axboe Reviewed-by: Mike Rapoport (Microsoft) Reviewed-by: Vlastimil Babka Signed-off-by: Christian Brauner Reviewed-by: Roman Gushchin --- include/linux/slab.h | 3 --- mm/slab_common.c | 43 ------------------------------------------- 2 files changed, 46 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index f74ceb788ac1..8246f9b28f43 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -270,9 +270,6 @@ struct kmem_cache *kmem_cache_create_usercopy(const char *name, slab_flags_t flags, unsigned int useroffset, unsigned int usersize, void (*ctor)(void *)); -struct kmem_cache *kmem_cache_create_rcu(const char *name, unsigned int size, - unsigned int freeptr_offset, - slab_flags_t flags); /* If NULL is passed for @args, use this variant with default arguments. */ static inline struct kmem_cache * diff --git a/mm/slab_common.c b/mm/slab_common.c index 418459927670..9133b9fafcb1 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -420,49 +420,6 @@ struct kmem_cache *__kmem_cache_create(const char *name, unsigned int size, } EXPORT_SYMBOL(__kmem_cache_create); -/** - * kmem_cache_create_rcu - Create a SLAB_TYPESAFE_BY_RCU 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. - * @freeptr_offset: The offset into the memory to the free pointer - * @flags: SLAB flags - * - * Cannot be called within an interrupt, but can be interrupted. - * - * See kmem_cache_create() for an explanation of possible @flags. - * - * By default SLAB_TYPESAFE_BY_RCU caches place the free pointer outside - * of the object. This might cause the object to grow in size. Callers - * that have a reason to avoid this can specify a custom free pointer - * offset in their struct where the free pointer will be placed. - * - * Note that placing the free pointer inside the object requires the - * caller to ensure that no fields are invalidated that are required to - * guard against object recycling (See SLAB_TYPESAFE_BY_RCU for - * details.). - * - * Using zero as a value for @freeptr_offset is valid. To request no - * offset UINT_MAX must be specified. - * - * Note that @ctor isn't supported with custom free pointers as a @ctor - * requires an external free pointer. - * - * Return: a pointer to the cache on success, NULL on failure. - */ -struct kmem_cache *kmem_cache_create_rcu(const char *name, unsigned int size, - unsigned int freeptr_offset, - slab_flags_t flags) -{ - struct kmem_cache_args kmem_args = { - .freeptr_offset = freeptr_offset, - .use_freeptr_offset = true, - }; - - return __kmem_cache_create_args(name, size, &kmem_args, - flags | SLAB_TYPESAFE_BY_RCU); -} -EXPORT_SYMBOL(kmem_cache_create_rcu); - static struct kmem_cache *kmem_buckets_cache __ro_after_init; /**