Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1732653pxm; Fri, 4 Mar 2022 02:19:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzTcmu7jiind1bMj+ZPonT5VM3896v8k111ahN6wqo3XAtyC0vlelx1pkKC+SeXZnTuEy1i X-Received: by 2002:a17:902:f342:b0:151:bbc3:2077 with SMTP id q2-20020a170902f34200b00151bbc32077mr2279816ple.87.1646389190976; Fri, 04 Mar 2022 02:19:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646389190; cv=none; d=google.com; s=arc-20160816; b=DSJ9cgKqDmWTvZPSqsBb3ZY/2IgiUuwKmrqPnRh8e4EhQUjio2iDzGhJqE9URUfLXs jnztWdLwgNEdBNd7aAO3ioIq5Q2vF+zwfOP4waHK4sNzi+vIYEoG8AckjAtEJNctUN3b HllXSwcO+gicSM/+Zx4/Dv39aFbFB3woDWDwt8JPAwH9DpUZXwCUTtDTAMuMPgfwoxPr lgC6EVMNzl4jljhfCvIlCkKWU7tcp09oRwcyFc3Npo2eELv/fsx1byLX46CaPHu4Qmj5 vIlcYLwzQYhHJ7kU4cqS2KSQ4A4xEMkNM3tO4YZ920ue1PB3dIMiZv1dgCyQ0Z3vYYdh IRqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=kPOOk68I4eD0EZtqHYKQaSrGBjBqSrtM4mnuv4oRjyQ=; b=YVGcdziJGWUxbcCLvmNNMf2ITP3PTn+9CCo2vwKsoPri/50MUg9Oe5rTLjJsJ7QoHR ne8rxRfA9TipuH2TLFkUrYrrRqouSq+J37LXGigvjJwPWgSmk4l7N5H5JZU+iD28RMjI OQX6MCfDGDR/s1W71C56uL5VJRKy/kWt20g9BaxN5Zhe+a9ma7OUOUyPi+pC/uSBgNtE CgXca+uxt5/FaeI22uNvdM3pE7IPkrryYMIvdVHUmAG6uKGN/XwVq36Km2aKs37MOogk R0c/uecXmmccjHUi9AEAXWai5dtF7UVkYJkl5TQWB4cp5ER8mXiGuApR6nYR3bqAAfzI ggtw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nDQzt1ph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id mw1-20020a17090b4d0100b001bc5f4208b8si11247981pjb.51.2022.03.04.02.19.35; Fri, 04 Mar 2022 02:19:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=nDQzt1ph; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238521AbiCDGgc (ORCPT + 99 others); Fri, 4 Mar 2022 01:36:32 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238481AbiCDGgQ (ORCPT ); Fri, 4 Mar 2022 01:36:16 -0500 Received: from mail-pj1-x102f.google.com (mail-pj1-x102f.google.com [IPv6:2607:f8b0:4864:20::102f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E77FE18E3E8 for ; Thu, 3 Mar 2022 22:34:50 -0800 (PST) Received: by mail-pj1-x102f.google.com with SMTP id m11-20020a17090a7f8b00b001beef6143a8so7164480pjl.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=pXentCywoqSr30KC+dN7fPjSaIpW+wsbuf3xJWY4bN/79g1HTfOIpMzXKSyA5UhXnJ JVYSCOI6e/ay0FqX4EkbFxDneVXTJ+O+HHuRv1vrWFWg+0kYnuPcqykm6W6zn85Q7gH+ rg5KzmB0OJM3w8eQIyrpL5WTJiGOWolvvcoH6d12ZaCde9vjcaQiW14aPBt0jDoo4Dz3 TcA3MQNzl8Q7aLqFpN6JXEmeXy1UgpBn/wCumMmmyRoAy9GSO60VnGRaUxcR+9ajOW9n QF0gHnFH+K3Y5DsNUKuaSMra+Xrt3qromqQPGpl1XT+kMBERwmvpLY6dXnu/oIXsspzS UPjA== X-Gm-Message-State: AOAM530dqYRpBVFjSjE9EqxbTkkU13hroxjZRNUBMnKCt+/i3d3uO6Kl kfKIbcRT6sTtVHFxiG75QAU= 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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-0.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HK_RANDOM_ENVFROM, HK_RANDOM_FROM,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org __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> --- 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) { -- 2.33.1