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

Submitted by Konstantin Khorenko on March 20, 2017, 1:41 p.m.

Details

Message ID 201703201341.v2KDfbDD004485@finist_cl7.x64_64.work.ct
State New
Series "fs: Prevent massive warn spamming"
Headers show

Commit Message

Konstantin Khorenko March 20, 2017, 1:41 p.m.
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@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@openvz.org>
---
 mm/page_alloc.c | 2 +-
 mm/slab.c       | 4 ++--
 mm/slub.c       | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

Patch hide | download patch | download mbox

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);
 }