From patchwork Fri Mar 4 06:34:25 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: 12768533 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 43DF2C433FE for ; Fri, 4 Mar 2022 06:34:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D1B8F8D0006; Fri, 4 Mar 2022 01:34:51 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CA2FB8D0001; Fri, 4 Mar 2022 01:34:51 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6B228D0006; Fri, 4 Mar 2022 01:34:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0205.hostedemail.com [216.40.44.205]) by kanga.kvack.org (Postfix) with ESMTP id A7AD88D0001 for ; Fri, 4 Mar 2022 01:34:51 -0500 (EST) Received: from smtpin27.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 51A868F848 for ; Fri, 4 Mar 2022 06:34:51 +0000 (UTC) X-FDA: 79205740782.27.3A50CFB Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) by imf31.hostedemail.com (Postfix) with ESMTP id EF8F720002 for ; Fri, 4 Mar 2022 06:34:50 +0000 (UTC) Received: by mail-pl1-f176.google.com with SMTP id n15so6909952plf.4 for ; Thu, 03 Mar 2022 22:34:50 -0800 (PST) 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=kPOOk68I4eD0EZtqHYKQaSrGBjBqSrtM4mnuv4oRjyQ=; b=nDQzt1phNSGQYKWCNk0gp2OnBhDzbFsLtVoMQZYprv1JockjSyVxMyhajm1xm7lr7V AWmFM71q4nLmK+IbMdcN4MrfIWcWUSusSJ2Ak1sFRxCRVgo9+yRWwtHiBLiO5kN6l0Cf yLLWwtivZxP28j4U1PbUfMvuJgkWTHpSgrnltIZ0HxRydMzgP58+XIo8ze8XNWAnBf2r jxc5GN7nej6IJEd/CXES7lSAJZ89+/JWxuMRhSr1m6iMiAkoym1w3oFIxqXIbLz27+YQ I4aOWtlXWIArSgaMdhm6eVGUNNI2Nn3Ars/MW3LDXBiy2RoYV6zkphnKYaYNQ1rT3Fwa B46Q== 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=kPOOk68I4eD0EZtqHYKQaSrGBjBqSrtM4mnuv4oRjyQ=; b=Gre/QyuL+DZt3bA06m4l/mJQ9G1IgoIth60LohStTTtAOLb75RZ3gLZaZ9v1BnkbtZ Uvdz2cKFaHYW2yfqaqaxTIjX8p0dVC0MaKTeSykTueiyd6FZFi2be6+jqzB+mSGdZcZ1 Ogmjbq2QUobgbURRPEWOS4oOewoXIGBsASCfA1fTJN7rb6pfMXFNTBC4pDaVZ+Nl0I99 gYsP5javZIQ70vFTGknAi9ZULbRsSgXYD8Pf295xmDUrV60DzfRDUgixi5RkWsnblxZg RRtWB9wJ5/f0hYRDYjjE12ocCdH0SaicDVceCAz+XXmUQPCIFczsO3TOxvNl3EhW009+ qMIg== X-Gm-Message-State: AOAM531NKvCdqn2jqg+HGV4mVOzqJhKX1dKHs1aSPdcVcH77lC58FIBU XBWXO1G+wdpwEurnxPS/XQq1S51teBoEXg== X-Google-Smtp-Source: ABdhPJx6Xk2mOdK3KCJoE/feOSg8DDkvCzteGHm0Tcc9N7Tq32/YEHDYtA7ATrAkhbz8I8OkNz0/Dg== X-Received: by 2002:a17:90a:eb07:b0:1be:f354:9404 with SMTP id j7-20020a17090aeb0700b001bef3549404mr9122314pjz.90.1646375689983; Thu, 03 Mar 2022 22:34:49 -0800 (PST) Received: from ip-172-31-19-208.ap-northeast-1.compute.internal (ec2-18-181-137-102.ap-northeast-1.compute.amazonaws.com. [18.181.137.102]) by smtp.gmail.com with ESMTPSA id v10-20020a056a00148a00b004e0f420dd90sm4900007pfu.40.2022.03.03.22.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 22:34:49 -0800 (PST) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: linux-mm@kvack.org Cc: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Marco Elver , Matthew WilCox , Roman Gushchin , linux-kernel@vger.kernel.org, 42.hyeyoo@gmail.com Subject: [PATCH v2 3/5] mm/sl[auo]b: move definition of __ksize() to mm/slab.h Date: Fri, 4 Mar 2022 06:34:25 +0000 Message-Id: <20220304063427.372145-4-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220304063427.372145-1-42.hyeyoo@gmail.com> References: <20220304063427.372145-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: EF8F720002 X-Stat-Signature: nr789s3zspezrc93kcxpb35bubypmrfy Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=nDQzt1ph; spf=pass (imf31.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.214.176 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspam-User: X-HE-Tag: 1646375690-540907 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. [ willy@infradead.org: Move definition to mm/slab.h and reduce comments ] 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 | 9 +-------- mm/slob.c | 1 - 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index e7b3330db4f3..d2b896553315 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -182,7 +182,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 31e98beb47a3..79b319d58504 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -685,6 +685,8 @@ static inline 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 1d2f92e871d2..b126fc7247b9 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1247,13 +1247,7 @@ EXPORT_SYMBOL(kfree_sensitive); #ifndef CONFIG_SLOB /** - * __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 + * __ksize -- Uninstrumented ksize. Only called by KASAN. */ size_t __ksize(const void *object) { @@ -1269,7 +1263,6 @@ size_t __ksize(const void *object) return slab_ksize(folio_slab(folio)->slab_cache); } -EXPORT_SYMBOL(__ksize); #endif /** diff --git a/mm/slob.c b/mm/slob.c index 60c5842215f1..d8af6c54f133 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -588,7 +588,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) {