[Devel] [PATCH RHEL7 COMMIT] mm/fs: Prevent massive warn spamming about memallocation caused fs reentrance

Konstantin Khorenko khorenko at virtuozzo.com
Mon Mar 20 06:41:37 PDT 2017


The commit is pushed to "branch-rh7-3.10.0-514.10.2.vz7.29.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.10.2.vz7.29.5
------>
commit b401c051bc8670f0a465e0d4893972808263622f
Author: Dmitry Monakhov <dmonakhov at openvz.org>
Date:   Mon Mar 20 17:41:36 2017 +0400

    mm/fs: Prevent massive warn spamming about memallocation caused fs reentrance
    
    Even if detection spots potential bug, is it not good to bloat kmsg.
    WARN_ON_ONCE is enough to detect exact calltrace.
    
    To be merged with 915bded ("mm/fs: Port
    diff-mm-debug-memallocation-caused-fs-reentrance").
    
    Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
---
 mm/page_alloc.c | 2 +-
 mm/slab.c       | 4 ++--
 mm/slub.c       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index ff163b2..afac33e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -3155,7 +3155,7 @@ __alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
 	lockdep_trace_alloc(gfp_mask);
 
 	might_sleep_if(gfp_mask & __GFP_WAIT);
-	WARN_ON((gfp_mask & __GFP_FS) && current->journal_info);
+	WARN_ON_ONCE((gfp_mask & __GFP_FS) && current->journal_info);
 
 	if (should_fail_alloc_page(gfp_mask, order))
 		return NULL;
diff --git a/mm/slab.c b/mm/slab.c
index f0e4b79..4f0c22e 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3343,7 +3343,7 @@ slab_alloc_node(struct kmem_cache *cachep, gfp_t flags, int nodeid,
 	flags &= gfp_allowed_mask;
 
 	lockdep_trace_alloc(flags);
-	WARN_ON((flags & __GFP_FS) && current->journal_info);
+	WARN_ON_ONCE((flags & __GFP_FS) && current->journal_info);
 
 	if (slab_should_failslab(cachep, flags))
 		return NULL;
@@ -3433,7 +3433,7 @@ slab_alloc(struct kmem_cache *cachep, gfp_t flags, unsigned long caller)
 	flags &= gfp_allowed_mask;
 
 	lockdep_trace_alloc(flags);
-	WARN_ON((flags & __GFP_FS) && current->journal_info);
+	WARN_ON_ONCE((flags & __GFP_FS) && current->journal_info);
 
 	if (slab_should_failslab(cachep, flags))
 		return NULL;
diff --git a/mm/slub.c b/mm/slub.c
index fcebd14..280adf6 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -1266,7 +1266,7 @@ static inline int slab_pre_alloc_hook(struct kmem_cache *s, gfp_t flags)
 	flags &= gfp_allowed_mask;
 	lockdep_trace_alloc(flags);
 	might_sleep_if(flags & __GFP_WAIT);
-	WARN_ON((flags & __GFP_FS) && current->journal_info);
+	WARN_ON_ONCE((flags & __GFP_FS) && current->journal_info);
 
 	return should_failslab(s->object_size, flags, s->flags);
 }


More information about the Devel mailing list