linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hyeonggon Yoo <42.hyeyoo@gmail.com>
To: linux-mm@kvack.org
Cc: Christoph Lameter <cl@linux.com>,
	Pekka Enberg <penberg@kernel.org>,
	David Rientjes <rientjes@google.com>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>, Marco Elver <elver@google.com>,
	Matthew WilCox <willy@infradead.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	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	[thread overview]
Message-ID: <20220304063427.372145-4-42.hyeyoo@gmail.com> (raw)
In-Reply-To: <20220304063427.372145-1-42.hyeyoo@gmail.com>

__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


  parent reply	other threads:[~2022-03-04  6:35 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-04  6:34 [PATCH v2 0/5] slab cleanups Hyeonggon Yoo
2022-03-04  6:34 ` [PATCH v2 1/5] mm/slab: kmalloc: pass requests larger than order-1 page to page allocator Hyeonggon Yoo
2022-03-04 12:45   ` Vlastimil Babka
2022-03-05  5:10     ` Hyeonggon Yoo
2022-03-04  6:34 ` [PATCH v2 2/5] mm/sl[au]b: unify __ksize() Hyeonggon Yoo
2022-03-04 18:25   ` Vlastimil Babka
2022-03-05  4:02     ` Hyeonggon Yoo
2022-03-04  6:34 ` Hyeonggon Yoo [this message]
2022-03-04 18:29   ` [PATCH v2 3/5] mm/sl[auo]b: move definition of __ksize() to mm/slab.h Vlastimil Babka
2022-03-05  4:03     ` Hyeonggon Yoo
2022-03-04  6:34 ` [PATCH v2 4/5] mm/slub: limit number of node partial slabs only in cache creation Hyeonggon Yoo
2022-03-04 18:33   ` Vlastimil Babka
2022-03-04  6:34 ` [PATCH v2 5/5] mm/slub: refactor deactivate_slab() Hyeonggon Yoo
2022-03-04 19:01   ` Vlastimil Babka
2022-03-05  4:21     ` Hyeonggon Yoo
2022-03-04 11:50 ` [PATCH v2 0/5] slab cleanups Marco Elver
2022-03-04 12:02   ` Hyeonggon Yoo
2022-03-04 13:11     ` Marco Elver
2022-03-04 16:42       ` Vlastimil Babka
2022-03-04 16:45         ` Marco Elver
2022-03-05  4:00       ` Hyeonggon Yoo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220304063427.372145-4-42.hyeyoo@gmail.com \
    --to=42.hyeyoo@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux.com \
    --cc=elver@google.com \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=penberg@kernel.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).