All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: linux-mm@kvack.org
Cc: Vlastimil Babka <vbabka@suse.cz>, Michal Hocko <mhocko@suse.com>,
	Thomas Gleixner <tglx@linutronix.de>
Subject: slab_pre_alloc_hook() strips __GFP_NOLOCKDEP away.
Date: Tue, 22 Mar 2022 18:39:44 +0100	[thread overview]
Message-ID: <YjoJ4CzB3yfWSV1F@linutronix.de> (raw)

Run into
| ======================================================
| WARNING: possible circular locking dependency detected
| 5.17.0-next-20220322 #19 Not tainted
| ------------------------------------------------------
| kswapd1/513 is trying to acquire lock:
| ffff888555b7e628 (&xfs_dir_ilock_class){++++}-{3:3}, at: xfs_icwalk_ag+0x36c/0x810
| 
| but task is already holding lock:
| ffffffff82a2fb20 (fs_reclaim){+.+.}-{0:0}, at: balance_pgdat+0x600/0x740
| 
| which lock already depends on the new lock.
| 
| 
| the existing dependency chain (in reverse order) is:
| 
| -> #1 (fs_reclaim){+.+.}-{0:0}:
|        fs_reclaim_acquire+0xaa/0xe0
|        __kmalloc_node+0x65/0x3e0
|        xfs_attr_copy_value+0x70/0xa0
…

and I think this is similar to commit
   704687deaae76 ("mm: make slab and vmalloc allocators __GFP_NOLOCKDEP aware")

and maybe something like this:

diff --git a/mm/slab.h b/mm/slab.h
--- a/mm/slab.h
+++ b/mm/slab.h
@@ -717,7 +717,7 @@ static inline struct kmem_cache *slab_pre_alloc_hook(struct kmem_cache *s,
 						     struct obj_cgroup **objcgp,
 						     size_t size, gfp_t flags)
 {
-	flags &= gfp_allowed_mask;
+	flags &= gfp_allowed_mask | __GFP_NOLOCKDEP;
 
 	might_alloc(flags);
 
?

Sebastian


             reply	other threads:[~2022-03-22 17:39 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 17:39 Sebastian Andrzej Siewior [this message]
2022-03-23 10:09 ` slab_pre_alloc_hook() strips __GFP_NOLOCKDEP away Vlastimil Babka
2022-03-23 11:30   ` Sebastian Andrzej Siewior
2022-03-23 11:45     ` Vlastimil Babka

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=YjoJ4CzB3yfWSV1F@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@suse.com \
    --cc=tglx@linutronix.de \
    --cc=vbabka@suse.cz \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.