From patchwork Tue Jul 12 13:39:45 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: 12915014 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 0611BC433EF for ; Tue, 12 Jul 2022 13:40:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 83766940084; Tue, 12 Jul 2022 09:40:45 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 7E91F940063; Tue, 12 Jul 2022 09:40:45 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 612B3940084; Tue, 12 Jul 2022 09:40:45 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 50A14940063 for ; Tue, 12 Jul 2022 09:40:45 -0400 (EDT) Received: from smtpin15.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id 254FB120C91 for ; Tue, 12 Jul 2022 13:40:45 +0000 (UTC) X-FDA: 79678558050.15.B449C43 Received: from mail-pf1-f175.google.com (mail-pf1-f175.google.com [209.85.210.175]) by imf25.hostedemail.com (Postfix) with ESMTP id B75FAA0071 for ; Tue, 12 Jul 2022 13:40:44 +0000 (UTC) Received: by mail-pf1-f175.google.com with SMTP id 70so7523169pfx.1 for ; Tue, 12 Jul 2022 06:40:44 -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=v0Ra2mCmkhs97lju56wkWDygUYxf+qFMbjtuR/xcWUM=; b=Va1EalHaI3VhS6se/mZId8N5nQGeKy3Rq1mFP+/nbgL2p5eorhQfrJo2xH1goELwTW bSgXKk5F4dpIAzZSCMZdKKBME6hVbFHbWFF+hBaYb0JIUWadGWnYBEbwZXjMaV4164Nf eVcahALSse4SL0m3uvkn+8tSvLOth1FJp8f16qG/nNgxonLO7u9v0xYZ5Q//sHtWHUye /2uvjrD3bxUF3r37JsNzxwA6GknccDJ3xdD7OpoBCk/+4PgR/5/rZ8qLZJ2gv9eQp1O7 e/ERHYiIRDrHIHiKR30VM0ssW6gIz7BK9sTsrdFvd0lOLgomJEE8wrEJWoTkJxvtSbHn eQQg== 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=v0Ra2mCmkhs97lju56wkWDygUYxf+qFMbjtuR/xcWUM=; b=N+shNTrdRpp6u32111ADTVLrCcIeDUrJMJg7PDbd0EcGvJxOLgTEY+XM04Z9tHehak zeo6epN8UF6W7vZu2zT1oCU2p67ix++XSGdk1vlmoLVGHUr/MhFRNtPgQG+pht2EOqSZ Dw9VoOuhGaPd8F4utEZJjBob17cEJrDfXgs/jmFMBU8WcmTSSMEADpKsTGhVeZ2/lQcq mfGgE7XpuHRNWAeu2l8QAHsxmuvLJn8pBZp8Z4HWDsAZwbxJ1k59ZO1DdZnJp12ucj8J tVWynZg/Xvfl3rEMeYfHbMXbVUu9nipLH/GDJtLtI4hwd8cw+m+VZt8+PRoJ6rPbZ2TV wpFQ== X-Gm-Message-State: AJIora90bvLFpEL5MtphRLIPVQjk8vt+sJFxGJkj7l8hooi9onqHYaU8 n8yE4GB9x4ABcFoO/jTn43c= X-Google-Smtp-Source: AGRyM1v3kohd9u7MCQ5n7GErcuU6Ao04BiPJQrX6vF2MBJLKb1sbj/DBi312niR5XFKEbIYrLHI69A== X-Received: by 2002:a63:6984:0:b0:40d:9ebe:5733 with SMTP id e126-20020a636984000000b0040d9ebe5733mr20810644pgc.170.1657633244244; Tue, 12 Jul 2022 06:40:44 -0700 (PDT) Received: from ip-172-31-24-42.ap-northeast-1.compute.internal (ec2-35-75-15-180.ap-northeast-1.compute.amazonaws.com. [35.75.15.180]) by smtp.gmail.com with ESMTPSA id r6-20020aa79886000000b0052ae3bcb807sm1947178pfl.188.2022.07.12.06.40.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Jul 2022 06:40:43 -0700 (PDT) From: Hyeonggon Yoo <42.hyeyoo@gmail.com> To: Christoph Lameter , Pekka Enberg , David Rientjes , Joonsoo Kim , Andrew Morton , Vlastimil Babka , Roman Gushchin , Hyeonggon Yoo <42.hyeyoo@gmail.com>, Joe Perches , Vasily Averin , Matthew WilCox Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH 15/16] mm/slab_common: move definition of __ksize() to mm/slab.h Date: Tue, 12 Jul 2022 13:39:45 +0000 Message-Id: <20220712133946.307181-16-42.hyeyoo@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220712133946.307181-1-42.hyeyoo@gmail.com> References: <20220712133946.307181-1-42.hyeyoo@gmail.com> MIME-Version: 1.0 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1657633244; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=v0Ra2mCmkhs97lju56wkWDygUYxf+qFMbjtuR/xcWUM=; b=gvZzSnRBxcbQPz02X8eeFogU1orWkxku8VJG94a3MceoT2w9dc12/KMQCpC91n+IrZNXX2 IEAMvX3jgFpbPonQ3z9Sf+myEeEzLdprWtDbrKsN1xNujpfC6YCFzLuLja/46Tbtqv8ekr uSHHOEgHe+ND26O/b4y3nYTlVeJ5jk8= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1657633244; a=rsa-sha256; cv=none; b=LlEpFTlTa1zuVfHMofTpZzWUFLccqilcOKJQJaefumkUHcKRWLYlBil5/7kPcIgHYNf1xR UpCJXb5+TUvL9HCCbO/M2/cgrGuAwYiT/m0vNr53UXdPj/DFeOPALUf8uoXuy11P4gStu4 cwqoQ2+qmuAtWHFU4ziDxkDhw9PcJpE= ARC-Authentication-Results: i=1; imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Va1EalHa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com X-Stat-Signature: 6wwsqih1f7g77rupy3eg5r7rsthdm6rh X-Rspamd-Queue-Id: B75FAA0071 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Va1EalHa; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf25.hostedemail.com: domain of 42.hyeyoo@gmail.com designates 209.85.210.175 as permitted sender) smtp.mailfrom=42.hyeyoo@gmail.com X-Rspamd-Server: rspam05 X-HE-Tag: 1657633244-478069 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 4ee5b2fed164..701fe538650f 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 9193e9c1f040..ad634e02b3cb 100644 --- a/mm/slab.h +++ b/mm/slab.h @@ -678,6 +678,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 c01c6b8f0d34..1f8db7959366 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -1003,15 +1003,7 @@ void kfree(const void *object) } 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; @@ -1026,7 +1018,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 97a4d2407f96..91d6e2b19929 100644 --- a/mm/slob.c +++ b/mm/slob.c @@ -584,7 +584,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) {