From patchwork Tue Apr 5 13:57:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Catalin Marinas X-Patchwork-Id: 12801562 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id C9DCBC433EF for ; Tue, 5 Apr 2022 14:07:12 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XJ7WKoCBMxYfsfMcxenFf5v0ZBLyOBqlvspk4bl7xVI=; b=lrWXd36Fcqr9Wb stjLRK3nKK+XS1XFDx/ppPdkai+lTOEj8oER/vEUXLtjdr4olicPNmBtpEEnKh/gn9qZ+rOClP5tL MwcWKGwGFix/EAVXZEgT0gF/NwjS8so0hZNCB7M2Pw6d1QWjoN0ku6REqMXCUADc5IxjSK1x19yBB MmYKfi7qjSyvFbozVVKVGEGxisBbacjK6F6ytUkfypa+Mgm0tGcB9cX/ffPD3j/Hwt9EZxMbPpT/H 0UncrdLg+Jo7tQxU8B/GJHhfv185mro+GPNDVDzl3UWLQiY8HZ8QSbv/0m6IDJXubk/Mp5iz1M0R7 Urswd0kZI/af4LGk2jaA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbjog-001Jbd-ET; Tue, 05 Apr 2022 14:05:54 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nbjhT-001G1i-BU for linux-arm-kernel@lists.infradead.org; Tue, 05 Apr 2022 13:58:30 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id A1BD761910; Tue, 5 Apr 2022 13:58:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2A697C385A7; Tue, 5 Apr 2022 13:58:24 +0000 (UTC) From: Catalin Marinas To: Will Deacon , Marc Zyngier , Arnd Bergmann , Greg Kroah-Hartman , Andrew Morton , Linus Torvalds Cc: linux-mm@kvack.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 09/10] mm/slab: Simplify create_kmalloc_cache() args and make it static Date: Tue, 5 Apr 2022 14:57:57 +0100 Message-Id: <20220405135758.774016-10-catalin.marinas@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220405135758.774016-1-catalin.marinas@arm.com> References: <20220405135758.774016-1-catalin.marinas@arm.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220405_065827_528075_C95A756C X-CRM114-Status: GOOD ( 16.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org create_kmalloc_cache() is now only called from new_kmalloc_cache() in the same file, so make it static. In addition, the useroffset argument is always 0 while usersize is the same as size. Remove them. Signed-off-by: Catalin Marinas Cc: Andrew Morton --- mm/slab.h | 3 --- mm/slab_common.c | 9 ++++----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mm/slab.h b/mm/slab.h index e9238406602a..d334b5e6d7aa 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -280,9 +280,6 @@ gfp_t kmalloc_fix_flags(gfp_t flags); /* Functions provided by the slab allocators */ int __kmem_cache_create(struct kmem_cache *, slab_flags_t flags); -struct kmem_cache *create_kmalloc_cache(const char *name, unsigned int size, - slab_flags_t flags, unsigned int useroffset, - unsigned int usersize); void __init new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags); extern void create_boot_cache(struct kmem_cache *, const char *name, diff --git a/mm/slab_common.c b/mm/slab_common.c index 594d8a8a68d0..3a9f7a1e6490 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -655,16 +655,15 @@ void __init create_boot_cache(struct kmem_cache *s, const char *name, s->refcount = -1; /* Exempt from merging for now */ } -struct kmem_cache *__init create_kmalloc_cache(const char *name, - unsigned int size, slab_flags_t flags, - unsigned int useroffset, unsigned int usersize) +static struct kmem_cache *__init create_kmalloc_cache(const char *name, + unsigned int size, slab_flags_t flags) { struct kmem_cache *s = kmem_cache_zalloc(kmem_cache, GFP_NOWAIT); if (!s) panic("Out of memory when creating slab %s\n", name); - create_boot_cache(s, name, size, flags, useroffset, usersize); + create_boot_cache(s, name, size, flags, 0, size); kasan_cache_create_kmalloc(s); list_add(&s->list, &slab_caches); s->refcount = 1; @@ -868,7 +867,7 @@ new_kmalloc_cache(int idx, enum kmalloc_cache_type type, slab_flags_t flags) if (!kmalloc_caches[type][aligned_idx]) kmalloc_caches[type][aligned_idx] = create_kmalloc_cache( kmalloc_info[aligned_idx].name[type], - aligned_size, flags, 0, aligned_size); + aligned_size, flags); if (idx != aligned_idx) kmalloc_caches[type][idx] = kmalloc_caches[type][aligned_idx];