[Devel] [PATCH rh7] Port diff-mm-debug-memallocation-caused-fs-reentrance

Vladimir Davydov vdavydov at parallels.com
Tue Jun 2 05:31:40 PDT 2015


Author: Dmitry Monakhov
Email: dmonakhov at openvz.org
Subject: mm: debug memallocation caused fs reentrance
Date: Sun, 9 Nov 2014 11:53:14 +0400

Signed-off-by: Dmitry Monakhov <dmonakhov at openvz.org>
=============================================================================

Related to https://jira.sw.ru/browse/PSBM-33640

Signed-off-by: Vladimir Davydov <vdavydov at parallels.com>
---
 mm/page_alloc.c | 1 +
 mm/slab.c       | 2 ++
 mm/slub.c       | 1 +
 3 files changed, 4 insertions(+)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 627677c585cb..8fbe1082cb9e 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -2690,6 +2690,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);
 
 	if (should_fail_alloc_page(gfp_mask, order))
 		return NULL;
diff --git a/mm/slab.c b/mm/slab.c
index d647f426f416..3c82384d63c2 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -3343,6 +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);
 
 	if (slab_should_failslab(cachep, flags))
 		return NULL;
@@ -3431,6 +3432,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);
 
 	if (slab_should_failslab(cachep, flags))
 		return NULL;
diff --git a/mm/slub.c b/mm/slub.c
index 6d5957adf3ef..347650c8ec1c 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -936,6 +936,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);
 
 	return should_failslab(s->object_size, flags, s->flags);
 }
-- 
2.1.4




More information about the Devel mailing list