mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Nikolay Borisov <nborisov@suse.com>
To: peterz@infradead.org
Cc: mingo@redhat.com, linux-kernel@vger.kernel.org,
	Nikolay Borisov <nborisov@suse.com>
Subject: [PATCH v2] lockdep: Teach lockdep about memalloc_noio_save
Date: Wed,  1 Mar 2017 09:59:00 +0200	[thread overview]
Message-ID: <1488355140-24528-1-git-send-email-nborisov@suse.com> (raw)
In-Reply-To: <1488354506-23774-1-git-send-email-nborisov@suse.com>

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)


 Turned out there was another place where RELCAIM_FS was being set, fix it 
 by using the memalloc_noio_flags when setting ->lockdep_reclaim_gfp flags.

diff --git a/kernel/locking/lockdep.c b/kernel/locking/lockdep.c
index 9812e5dd409e..87cf9910e66f 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 */
@@ -3852,7 +3853,7 @@ EXPORT_SYMBOL_GPL(lock_unpin_lock);
 
 void lockdep_set_current_reclaim_state(gfp_t gfp_mask)
 {
-	current->lockdep_reclaim_gfp = gfp_mask;
+	current->lockdep_reclaim_gfp = memalloc_noio_flags(gfp_mask);
 }
 
 void lockdep_clear_current_reclaim_state(void)
-- 
2.7.4

  reply	other threads:[~2017-03-01  9:14 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-01  7:48 [PATCH] " Nikolay Borisov
2017-03-01  7:59 ` Nikolay Borisov [this message]
2017-03-01  9:46   ` [PATCH v2] " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1488355140-24528-1-git-send-email-nborisov@suse.com \
    --to=nborisov@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®