From patchwork Tue Mar 8 11:41:41 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: 12773575 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 54A26C433EF for ; Tue, 8 Mar 2022 11:43:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E855D8D0002; Tue, 8 Mar 2022 06:43:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E348F8D0001; Tue, 8 Mar 2022 06:43:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CFD068D0002; Tue, 8 Mar 2022 06:43:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id C25298D0001 for ; Tue, 8 Mar 2022 06:43:04 -0500 (EST) Received: from smtpin23.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 867F6A89B3 for ; Tue, 8 Mar 2022 11:43:04 +0000 (UTC) X-FDA: 79221032688.23.B76E9C2 Received: from mail-pj1-f45.google.com (mail-pj1-f45.google.com [209.85.216.45]) by imf15.hostedemail.com (Postfix) with ESMTP id 03007A0004 for ; Tue, 8 Mar 2022 11:43:03 +0000 (UTC) Received: by mail-pj1-f45.google.com with SMTP id m22so16951475pja.0 for ; Tue, 08 Mar 2022 03:43:03 -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=C+Jsu4HCVJIvVBTQ9bsapoPPM3jCvdQzttLGL+ZzKMY=; b=jHF9PDv3hq3gkQfo5TFIFXhcA/79kEEdYCzpEA/d2mjRF6bc6Gwd1MihJqJmY1UNmc WiD5vCHHqS1j99+Db/d+9ztOYMQKy4/E09xga6rVJMW0cryzeV0Oacb4lz0dzG9DY3y5 UbpZtTU8pIHuu+xWv3oNoF83r9h3ixhfPsNwwd2I44nGZotZrdp374+gbS3zQRmkvLxh 8851L7qhzLv6A6szvy04sWjKSRVXp5clOMDLhTXnNIsUsSGod+X06uiJyFbfJr9faNj4 ZgJwGgqYDx0I2vbjXmrtBo931m/EqAtoR7d+NwX5g0TKsoRQuZZvNu9cfjeeCWZxc3Bc rFFA== 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=C+Jsu4HCVJIvVBTQ9bsapoPPM3jCvdQzttLGL+ZzKMY=; b=ROSEfxEYCttcyC13PuGZKdScmS7W6KlWqG5cn19VLNNxrYL9j9/ZCiYQMgUoO52wpy PnFK1e3Vmb4TFSE+N9Qe/iq5BUYPK633ucO2ZeRONpiuf2Y+slZ/9adrhd61suYQI79H dtUIDKZZSvsuLklri/eowRcDbs0j5tBDMhkiJ/mBhCQ7TmpXhRYQt1e6iu8yyJ0R6p4x z8bmy6RJ34ZDNg6s5GadIi3tud+chZfkeKsMYnsslXqb23ke6xFEiCFG+kbc7tDdP54E CIcXQ1OKD5eUSuDiZShKRDvJNz4RoXVSEuB+UuMBW3PGuNPxGoXU6BsdZ5udYYM9gt4q F3aw== X-Gm-Message-State: AOAM532Kc1uIS6jqjD2AS9XLQoMRMndMJqGtw2CXI/JgKL6BQnSl41Gl 3Q+m8g2NNd+SgNABJYB1eqQtPSdno6nDWA== X-Google-Smtp-Source: ABdhPJx4KwQ5pJZuufi0rCbWEqcdat0s5xevU2SvD3q7sL0/CrSOfOaXj/E7yf7qfpnShkF6fKTIlA== X-Received: by 2002:a17:90b:1652:b0:1bf:32e9:6db3 with SMTP id il18-20020a17090b165200b001bf32e96db3mr4209347pjb.179.1646739782835; Tue, 08 Mar 2022 03:43:02 -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 i2-20020a17090ac40200b001bd0e552d27sm2578285pjt.11.2022.03.08.03.42.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:43:01 -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: [RFC PATCH v1 14/15] mm/sl[auo]b: move definition of __ksize() to mm/slab.h Date: Tue, 8 Mar 2022 11:41:41 +0000 Message-Id: <20220308114142.1744229-15-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20220308114142.1744229-1-42.hyeyoo@gmail.com> References: <20220308114142.1744229-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 X-Rspamd-Server: rspam10 X-Rspam-User: X-Stat-Signature: qddknjemcrxghonjii17pwouog711sy9 Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=jHF9PDv3; spf=pass (imf15.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.216.45 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Queue-Id: 03007A0004 X-HE-Tag: 1646739783-545702 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 | 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 8da8beff712f..a3f8a103f318 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 bfedfe3900bb..4fd4bd7bb4d7 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -673,6 +673,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 6533026b4a6b..07ed382ed5a9 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -976,15 +976,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; @@ -999,7 +991,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 836a7d1ae996..59ddf80e987c 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) {