From patchwork Thu Apr 14 08:57:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hyeonggon Yoo <42.hyeyoo@gmail.com> X-Patchwork-Id: 12813173 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 03866C433EF for ; Thu, 14 Apr 2022 08:59:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 9CF166B0071; Thu, 14 Apr 2022 04:59:56 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 97ECF6B007B; Thu, 14 Apr 2022 04:59:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 86EE76B007E; Thu, 14 Apr 2022 04:59:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 7A8896B0071 for ; Thu, 14 Apr 2022 04:59:56 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4A42325201 for ; Thu, 14 Apr 2022 08:59:56 +0000 (UTC) X-FDA: 79354887192.14.6EBCF79 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf29.hostedemail.com (Postfix) with ESMTP id AB17E120006 for ; Thu, 14 Apr 2022 08:59:55 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id md4so4515047pjb.4 for ; Thu, 14 Apr 2022 01:59:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=NORyvB92HhMuMei+Pomh8Oih3TxPvQvxBtXd7TKFrXs=; b=cYuAPq95v2bjnqMdfyAhTbn9wVgLymi4gKjixUDP+cO7CMfR4/fi7HonSlCYGSwsRC juz4svkPR8qlGI/1jbF6uq2yJWXSJ+XmzrgSEaXXO7WOG3oeUozWp50ZdbPfTLH863HW rE32U++MGWqz45csIVcjq1DdTRF2VuTW/xbEr5SkJWoclIRte41zD1rdFWJMivW++xfE gDfBcr8IwjMw8mfQAwFGkiUrPtkaV1PNyIvL3HDqe1HWHyjKWLQtHF+12x5afHVEYOHU lfd2lswe3lQ4L1IXLAN/Vc9XajD/XmsRzdwMGHVkWPCOFGJqp8Wiva+CavFuKgFuYHCZ 5O+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=NORyvB92HhMuMei+Pomh8Oih3TxPvQvxBtXd7TKFrXs=; b=uO2lY9yHB/wYNY8V6K+NuTEDlWFaPH5skQGvZY1Vpaf9lKKk+ClUIlnUY+OoEXJaVa 1U7FL4uZS3+lZkxEFPZ2BubfPmJ+bH5gSBCYVXQjzzS+t8Rxk7zEtRZ5p7y7e7QFp4jO oh3wKxL4uZCKboCLzB4GwhuSvnQPoxUvQEOuufvkksTe+fGEmrD/tgJoC3Ts3R4pdMvT w0XRwgjt6l10DHsxQJlEUQpafyRiWfb/AKrVU9+T2tnQvHqGTE5fV5vbgqgFE5I61e/u uc+T7llIMVtJsDfx4heLx1uBrFk7XHVxaWxFgmdETF0cy1M/aRbK/dOlS58wxbu6nn6H nZKg== X-Gm-Message-State: AOAM530cDqKPWHXXqVppa6d7Ko3bQ+jY8i4e5BDu4q8HXOp2RxaOTwaH /Nq7Zi9nb2R0YBWqQ8qEXG4= X-Google-Smtp-Source: ABdhPJyohnd8KppvDlxmWverlmJ9PEfUJInYQHrOa24aW7oR0ao4/RGtPXE31A73I2fqb5HQ5QEs3g== X-Received: by 2002:a17:90b:4d01:b0:1cd:46e8:215a with SMTP id mw1-20020a17090b4d0100b001cd46e8215amr2640027pjb.73.1649926794713; Thu, 14 Apr 2022 01:59:54 -0700 (PDT) Received: from hyeyoo.. ([114.29.24.243]) by smtp.gmail.com with ESMTPSA id p9-20020aa79e89000000b00505fada20dfsm1403537pfq.117.2022.04.14.01.59.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 Apr 2022 01:59:53 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Vlastimil Babka Cc: Marco Elver , Matthew WilCox , Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Roman Gushchin , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 22/23] mm/sl[auo]b: move definition of __ksize() to mm/slab.h Date: Thu, 14 Apr 2022 17:57:26 +0900 Message-Id: <20220414085727.643099-23-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20220414085727.643099-1-42.hyeyoo@gmail.com> References: <20220414085727.643099-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=cYuAPq95; spf=pass (imf29.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: AB17E120006 X-Stat-Signature: 18yzpfsuh6is4snfcp97wd6yytaw9g5h X-HE-Tag: 1649926795-452691 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: __ksize() is only called by KASAN. Remove export symbol and move definition to mm/slab.h as we don't want to grow its callers. Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com> Reviewed-by: Vlastimil Babka --- include/linux/slab.h | 1 - mm/slab.h | 2 ++ mm/slab_common.c | 11 +---------- mm/slob.c | 1 - 4 files changed, 3 insertions(+), 12 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index c1aed9d97cf2..e30c0675d6b2 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -187,7 +187,6 @@ int kmem_cache_shrink(struct kmem_cache *s); void * __must_check krealloc(const void *objp, size_t new_size, gfp_t flags) __alloc_size(2); void kfree(const void *objp); void kfree_sensitive(const void *objp); -size_t __ksize(const void *objp); size_t ksize(const void *objp); #ifdef CONFIG_PRINTK bool kmem_valid_obj(void *object); diff --git a/mm/slab.h b/mm/slab.h index 45ddb19df319..5a500894317b 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -690,6 +690,8 @@ void free_large_kmalloc(struct folio *folio, void *object); #endif /* CONFIG_SLOB */ +size_t __ksize(const void *objp); + static inline size_t slab_ksize(const struct kmem_cache *s) { #ifndef CONFIG_SLUB diff --git a/mm/slab_common.c b/mm/slab_common.c index af563e64e8aa..8facade42bdd 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -984,15 +984,7 @@ void kfree(const void *x) } EXPORT_SYMBOL(kfree); -/** - * __ksize -- Uninstrumented ksize. - * @objp: pointer to the object - * - * Unlike ksize(), __ksize() is uninstrumented, and does not provide the same - * safety checks as ksize() with KASAN instrumentation enabled. - * - * Return: size of the actual memory used by @objp in bytes - */ +/* Uninstrumented ksize. Only called by KASAN. */ size_t __ksize(const void *object) { struct folio *folio; @@ -1007,7 +999,6 @@ size_t __ksize(const void *object) return slab_ksize(folio_slab(folio)->slab_cache); } -EXPORT_SYMBOL(__ksize); #endif /* !CONFIG_SLOB */ gfp_t kmalloc_fix_flags(gfp_t flags) diff --git a/mm/slob.c b/mm/slob.c index e893d182d471..adf794d58eb5 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -576,7 +576,6 @@ size_t __ksize(const void *block) m = (unsigned int *)(block - align); return SLOB_UNITS(*m) * SLOB_UNIT; } -EXPORT_SYMBOL(__ksize); int __kmem_cache_create(struct kmem_cache *c, slab_flags_t flags) {