lkml.org 
[lkml]   [2019]   [Apr]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 2/2] mm, slub: add missing kmem_cache_debug() checks
Date
Some debugging checks in SLUB are not hidden behind kmem_cache_debug() check.
Add the check so that those places can also benefit from reduced overhead
thanks to the the static key added by the previous patch.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
---
mm/slub.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 398e53e16e2e..9d1b0e5e8593 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1086,6 +1086,13 @@ static inline void dec_slabs_node(struct kmem_cache *s, int node, int objects)
static void setup_object_debug(struct kmem_cache *s, struct page *page,
void *object)
{
+ /*
+ * __OBJECT_POISON implies SLAB_POISON which is covered by
+ * kmem_cache_debug()
+ */
+ if (!kmem_cache_debug(s))
+ return;
+
if (!(s->flags & (SLAB_STORE_USER|SLAB_RED_ZONE|__OBJECT_POISON)))
return;

@@ -1095,6 +1102,9 @@ static void setup_object_debug(struct kmem_cache *s, struct page *page,

static void setup_page_debug(struct kmem_cache *s, void *addr, int order)
{
+ if (!kmem_cache_debug(s))
+ return;
+
if (!(s->flags & SLAB_POISON))
return;

@@ -1734,7 +1744,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
int order = compound_order(page);
int pages = 1 << order;

- if (s->flags & SLAB_CONSISTENCY_CHECKS) {
+ if (kmem_cache_debug(s) && s->flags & SLAB_CONSISTENCY_CHECKS) {
void *p;

slab_pad_check(s, page);
--
2.21.0
\
 
 \ /
  Last update: 2019-04-04 11:16    [W:0.083 / U:0.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site