public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] lockdep: Teach lockdep about memalloc_noio_save
@ 2017-03-01  7:48 Nikolay Borisov
  2017-03-01  7:59 ` [PATCH v2] " Nikolay Borisov
  2017-03-01 10:22 ` [PATCH] " Vlastimil Babka
  0 siblings, 2 replies; 9+ messages in thread
From: Nikolay Borisov @ 2017-03-01  7:48 UTC (permalink / raw)
  To: peterz; +Cc: mingo, linux-kernel, Nikolay Borisov

Commit 21caf2fc1931 ("mm: teach mm by current context info to not do I/O
during memory allocation") added the memalloc_noio_(save|restore) functions
to enable people to modify the MM behavior by disbaling I/O during memory
allocation. This prevents allocation paths recursing back into the filesystem
without explicitly changing the flags for every allocation site. Yet, lockdep
not being aware of that is prone to showing false positives. Fix this
by teaching it that the presence of PF_MEMALLOC_NOIO flag mean we are not
going to issue any I/O

Signed-off-by: Nikolay Borisov <nborisov@suse.com>
---
 kernel/locking/lockdep.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 9812e5dd409e..5715fdcede28 100644
--- a/kernel/locking/lockdep.c
+++ b/kernel/locking/lockdep.c
@@ -2866,7 +2866,8 @@ static void __lockdep_trace_alloc(gfp_t gfp_mask, unsigned long flags)
 		return;
 
 	/* this guy won't enter reclaim */
-	if ((curr->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC))
+	if (((curr->flags & PF_MEMALLOC) && !(gfp_mask & __GFP_NOMEMALLOC)) ||
+			curr->flags & PF_MEMALLOC_NOIO)
 		return;
 
 	/* We're only interested __GFP_FS allocations for now */
-- 
2.7.4

^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2017-03-01 11:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-01  7:48 [PATCH] lockdep: Teach lockdep about memalloc_noio_save Nikolay Borisov
2017-03-01  7:59 ` [PATCH v2] " Nikolay Borisov
2017-03-01  9:46   ` Peter Zijlstra
2017-03-01  9:57     ` Nikolay Borisov
2017-03-01 10:03       ` Peter Zijlstra
2017-03-01 10:23         ` Vlastimil Babka
2017-03-01 10:22 ` [PATCH] " Vlastimil Babka
2017-03-01 10:31   ` Michal Hocko
2017-03-01 11:07     ` Nikolay Borisov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox