Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [linux-next:master] [mm]  b9b1861d4f: WARNING:possible_circular_locking_dependency_detected
@ 2026-10-09  6:46 kernel test robot
  2026-10-09  7:58 ` Qi Zheng
  0 siblings, 1 reply; 6+ messages in thread
From: kernel test robot @ 2026-10-09  6:46 UTC (permalink / raw)
  To: Qi Zheng
  Cc: oe-lkp, lkp, Andrew Morton, Baolin Wang, Christian Brauner,
	David Hildenbrand, Hugh Dickins, Johannes Weiner, Michal Hocko,
	Muchun Song, Roman Gushchin, Shakeel Butt, Qinyun Tan, linux-mm,
	yi1.lai



Hello,

kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on:

commit: b9b1861d4f7ae63b15228c744d504a86ab48a5a2 ("mm: shmem: make unused huge shrinker memcg aware") https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master

[test failed on linux-next/master f5f84daefcd92d7a630066635ecea1433ed5eac7]

in testcase: boot

config: i386-randconfig-053-20260902
compiler: clang-22
test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 4 -m 4G

(please refer to attached dmesg/kmsg for entire log/backtrace)

If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <yi1.lai@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202610091403.d1d8080b-lkp@intel.com

[   64.638596][  T203] ======================================================
[   64.643742][  T203] WARNING: possible circular locking dependency detected
[   64.649127][  T203] 7.3.0-rc4+ #1 Not tainted
[   64.652392][  T203] ------------------------------------------------------
[   64.657842][  T203] systemd-udevd/203 is trying to acquire lock:
[   64.663589][  T203] f5835900 (&sb->s_type->i_lock_key){+.+.}-{3:3}, at: igrab+0x44/0xc0
[   64.669221][  T203]
[   64.669221][  T203] but task is already holding lock:
[   64.669221][  T203]
[   64.669221][  T203] but task is already holding lock:
[   64.669221][  T203]
[   64.669221][  T203] but task is already holding lock:
[   64.674183][  T203] f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
[   64.679737][  T203]
[   64.679737][  T203] which lock already depends on the new lock.
[   64.679737][  T203]
[   64.679737][  T203] which lock already depends on the new lock.
[   64.679737][  T203]
[   64.679737][  T203] which lock already depends on the new lock.
[   64.679737][  T203]
[   64.686427][  T203]
[   64.686427][  T203] the existing dependency chain (in reverse order) is:
[   64.686427][  T203]
[   64.686427][  T203] the existing dependency chain (in reverse order) is:
[   64.686427][  T203]
[   64.686427][  T203] the existing dependency chain (in reverse order) is:
[   64.691963][  T203]
[   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
[   64.691963][  T203]
[   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
[   64.691963][  T203]
[   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
[   64.695874][  T203]        _raw_spin_lock+0x26/0x40
[   64.699072][  T203]        list_lru_add_obj+0x3c/0xc0
[   64.702561][  T203]        d_lru_add+0x40/0x80
[   64.705640][  T203]        fast_dput+0x1c7/0x200
[   64.708794][  T203]        dput+0x25/0x40
[   64.711603][  T203]        pick_link+0x1ed/0x340
[   64.714612][  T203]        step_into_slowpath+0x1af/0x200
[   64.718143][  T203]        path_lookupat+0x109/0x1c0
[   64.721512][  T203]        filename_lookup+0xc1/0x200
[   64.725044][  T203]        user_path_at+0x2f/0xc0
[   64.728522][  T203]        __ia32_sys_mount+0x134/0x1c0
[   64.732025][  T203]        ia32_sys_call+0x39/0x14c0
[   64.735800][  T203]        __do_fast_syscall_32+0x16c/0x340
[   64.740069][  T203]        do_fast_syscall_32+0x28/0x80
[   64.743715][  T203]        do_SYSENTER_32+0x12/0x40
[   64.747337][  T203]        entry_SYSENTER_32+0x98/0xfd
[   64.750971][  T203]
[   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
[   64.750971][  T203]
[   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
[   64.750971][  T203]
[   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
[   64.756528][  T203]        _raw_spin_lock+0x26/0x40
[   64.760072][  T203]        d_instantiate+0x34/0x80
[   64.763562][  T203]        d_make_root+0x29/0x40
[   64.766867][  T203]        shmem_fill_super+0x292/0x340
[   64.770617][  T203]        get_tree_nodev+0x3e/0x80
[   64.774112][  T203]        shmem_get_tree+0x12/0x40
[   64.777728][  T203]        vfs_get_tree+0x1e/0xc0
[   64.781170][  T203]        vfs_kern_mount+0x6e/0xc0
[   64.784747][  T203]        kern_mount+0x16/0x40
[   64.787998][  T203]        shmem_init+0x26/0x100
[   64.791525][  T203]        mnt_init+0xfd/0x140
[   64.794594][  T203]        vfs_caches_init+0x26/0x40
[   64.798341][  T203]        start_kernel+0x2df/0x380
[   64.801707][  T203]        i386_start_kernel+0xc5/0x100
[   64.805611][  T203]        startup_32_smp+0x151/0x160
[   64.809276][  T203]
[   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
[   64.809276][  T203]
[   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
[   64.809276][  T203]
[   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
[   64.815036][  T203]        __lock_acquire+0x1851/0x2a40
[   64.818649][  T203]        lock_acquire+0x96/0x200
[   64.821879][  T203]        _raw_spin_lock+0x26/0x40
[   64.825139][  T203]        igrab+0x44/0xc0
[   64.828067][  T203]        shmem_unused_huge_isolate+0x2e/0xc0
[   64.832099][  T203]        __list_lru_walk_one+0x98/0x180
[   64.835960][  T203]        list_lru_walk_node+0x1b/0x40
[   64.839660][  T203]        shmem_unused_huge_shrink+0x62/0x500
[   64.843880][  T203]        shmem_alloc_and_add_folio+0x1b8/0x480
[   64.847901][  T203]        shmem_get_folio_gfp+0x1af/0x880
[   64.851755][  T203]        shmem_write_begin+0x5c/0x100
[   64.855571][  T203]        generic_perform_write+0xc1/0x340
[   64.859545][  T203]        shmem_file_write_iter+0x5f/0x80
[   64.863719][  T203]        vfs_write+0x263/0x340
[   64.867230][  T203]        ksys_write+0x6a/0x100
[   64.870798][  T203]        __ia32_sys_write+0x18/0x40
[   64.874740][  T203]        ia32_sys_call+0x1365/0x14c0
[   64.878135][  T203]        __do_fast_syscall_32+0x16c/0x340
[   64.881546][  T203]        do_fast_syscall_32+0x28/0x80
[   64.885606][  T203]        do_SYSENTER_32+0x12/0x40
[   64.889087][  T203]        entry_SYSENTER_32+0x98/0xfd
[   64.892908][  T203]
[   64.892908][  T203] other info that might help us debug this:
[   64.892908][  T203]
[   64.892908][  T203] other info that might help us debug this:
[   64.892908][  T203]
[   64.892908][  T203] other info that might help us debug this:
[   64.892908][  T203]
[   64.900253][  T203] Chain exists of:
[   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
[   64.900253][  T203]
[   64.900253][  T203] Chain exists of:
[   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
[   64.900253][  T203]
[   64.900253][  T203] Chain exists of:
[   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
[   64.900253][  T203]
[   64.909551][  T203]  Possible unsafe locking scenario:
[   64.909551][  T203]
[   64.909551][  T203]  Possible unsafe locking scenario:
[   64.909551][  T203]
[   64.909551][  T203]  Possible unsafe locking scenario:
[   64.909551][  T203]
[   64.915049][  T203]        CPU0                    CPU1
[   64.918939][  T203]        ----                    ----
[   64.922808][  T203]   lock(&l->lock);
[   64.925634][  T203]                                lock(&lockref->lock);
[   64.930586][  T203]                                lock(&l->lock);
[   64.934913][  T203]   lock(&sb->s_type->i_lock_key);
[   64.938686][  T203]
[   64.938686][  T203]  *** DEADLOCK ***
[   64.938686][  T203]
[   64.938686][  T203]  *** DEADLOCK ***
[   64.938686][  T203]
[   64.938686][  T203]  *** DEADLOCK ***
[   64.938686][  T203]
[   64.944491][  T203] locks held by systemd-udevd/203: 4, last CPU#0:
[   64.949046][  T203]  #0: f5c50a6c (sb_writers#6){.+.+}-{0:0}, at: vfs_write+0xb7/0x340
[   64.954944][  T203]  #1: f5655658 (&sb->s_type->i_mutex_key#13){+.+.}-{4:4}, at: shmem_file_write_iter+0x28/0x80
[   64.962274][  T203]  #2: f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
[   64.968148][  T203]  #3: f5835810 (&info->lock){+.+.}-{3:3}, at: shmem_unused_huge_isolate+0x1f/0xc0
[   64.974409][  T203]
[   64.974409][  T203] stack backtrace:
[   64.974409][  T203]
[   64.974409][  T203] stack backtrace:
[   64.974409][  T203]
[   64.974409][  T203] stack backtrace:
[   64.978786][  T203] CPU: 0 UID: 0 PID: 203 Comm: systemd-udevd Not tainted 7.3.0-rc4+ #1 PREEMPT  2f9698b0cc81084abb5f3c5754f76765d21e2bf0
[   64.987668][  T203] Call Trace:
[   64.990012][  T203]  __dump_stack+0x18/0x40
[   64.993281][  T203]  dump_stack_lvl+0x20/0x40
[   64.996699][  T203]  dump_stack+0xd/0x12
[   64.999644][  T203]  print_circular_bug+0x2bf/0x300
[   65.003228][  T203]  check_noncircular+0xd7/0x100
[   65.006753][  T203]  __lock_acquire+0x1851/0x2a40
[   65.009733][  T203]  ? _raw_spin_unlock_irqrestore+0x20/0x80
[   65.013953][  T203]  lock_acquire+0x96/0x200
[   65.017236][  T203]  ? igrab+0x44/0xc0
[   65.020072][  T203]  _raw_spin_lock+0x26/0x40
[   65.023308][  T203]  ? igrab+0x44/0xc0
[   65.025972][  T203]  igrab+0x44/0xc0
[   65.028647][  T203]  shmem_unused_huge_isolate+0x2e/0xc0
[   65.032472][  T203]  __list_lru_walk_one+0x98/0x180
[   65.035619][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
[   65.039875][  T203]  list_lru_walk_node+0x1b/0x40
[   65.043576][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
[   65.047582][  T203]  shmem_unused_huge_shrink+0x62/0x500
[   65.051774][  T203]  ? shmem_inode_acct_blocks+0x218/0x280
[   65.055593][  T203]  shmem_alloc_and_add_folio+0x1b8/0x480
[   65.059093][  T203]  shmem_get_folio_gfp+0x1af/0x880
[   65.062996][  T203]  shmem_write_begin+0x5c/0x100
[   65.066769][  T203]  generic_perform_write+0xc1/0x340
[   65.070595][  T203]  shmem_file_write_iter+0x5f/0x80
[   65.074058][  T203]  vfs_write+0x263/0x340
[   65.077047][  T203]  ? shmem_file_read_iter+0x400/0x400
[   65.081058][  T203]  ksys_write+0x6a/0x100
[   65.084028][  T203]  __ia32_sys_write+0x18/0x40
[   65.087227][  T203]  ia32_sys_call+0x1365/0x14c0
[   65.090769][  T203]  __do_fast_syscall_32+0x16c/0x340
[   65.094701][  T203]  ? do_fast_syscall_32+0x28/0x80
[   65.098687][  T203]  do_fast_syscall_32+0x28/0x80
[   65.102284][  T203]  do_SYSENTER_32+0x12/0x40
[   65.105857][  T203]  entry_SYSENTER_32+0x98/0xfd
[   65.109406][  T203] EIP: 0xa7fbbc4c
[   65.112302][  T203] Code: c0 74 05 c1 e9 0c 89 08 31 c0 5e 5d 31 c9 31 d2 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 8d 76 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 58 b8
[   65.127608][  T203] EAX: ffffffda EBX: 00000010 ECX: 0238cb60 EDX: 00000023
[   65.133201][  T203] ESI: 00000023 EDI: 0238cb60 EBP: 0238a5e0 ESP: afef94f0
[   65.138647][  T203] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00200246


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20261009/202610091403.d1d8080b-lkp@intel.com

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




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

* Re: [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected
  2026-10-09  6:46 [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected kernel test robot
@ 2026-10-09  7:58 ` Qi Zheng
  2026-10-10  2:07   ` kernel test rebot
  2026-10-10 23:16   ` Andrew Morton
  0 siblings, 2 replies; 6+ messages in thread
From: Qi Zheng @ 2026-10-09  7:58 UTC (permalink / raw)
  To: kernel test robot
  Cc: oe-lkp, lkp, Andrew Morton, Baolin Wang, Christian Brauner,
	David Hildenbrand, Hugh Dickins, Johannes Weiner, Michal Hocko,
	Muchun Song, Roman Gushchin, Shakeel Butt, Qinyun Tan, linux-mm

Thanks for the report!

On 10/9/26 2:46 PM, kernel test robot wrote:
> 
> 
> Hello,
> 
> kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on:
> 
> commit: b9b1861d4f7ae63b15228c744d504a86ab48a5a2 ("mm: shmem: make unused huge shrinker memcg aware") https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
> 
> [test failed on linux-next/master f5f84daefcd92d7a630066635ecea1433ed5eac7]
> 
> in testcase: boot
> 
> config: i386-randconfig-053-20260902
> compiler: clang-22
> test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 4 -m 4G
> 
> (please refer to attached dmesg/kmsg for entire log/backtrace)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <yi1.lai@intel.com>
> | Closes: https://lore.kernel.org/oe-lkp/202610091403.d1d8080b-lkp@intel.com
> 
> [   64.638596][  T203] ======================================================
> [   64.643742][  T203] WARNING: possible circular locking dependency detected
> [   64.649127][  T203] 7.3.0-rc4+ #1 Not tainted
> [   64.652392][  T203] ------------------------------------------------------

This does not look like an actual deadlock.  The list_lru lock held by
shmem_unused_huge_isolate() belongs to the shmem unused huge shrinklist,
while the existing dependency was recorded for the dentry LRU.  These
are distinct lock instances.

However, both locks use the default list_lru lock class, so lockdep
treats them as the same lock and combines their dependency chains.

Could you please help test whether the following change makes the
lockdep warning go away?

diff --git a/mm/shmem.c b/mm/shmem.c
index 5a9bcc7c66926..8ee767dccc1f6 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5162,6 +5162,8 @@ static const struct dentry_operations 
shmem_ci_dentry_ops = {
  };
  #endif

+static struct lock_class_key shmem_unused_huge_lock_key;
+
  static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
  {
         struct shmem_options *ctx = fc->fs_private;
@@ -5243,7 +5245,8 @@ static int shmem_fill_super(struct super_block 
*sb, struct fs_context *fc)
                 goto failed;

  #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-       if (list_lru_init_memcg(&sbinfo->shrinklist, sb->s_shrink))
+       if (list_lru_init_memcg_key(&sbinfo->shrinklist, sb->s_shrink,
+                                   &shmem_unused_huge_lock_key))
                 goto failed;
  #endif


Thanks,
Qi


> [   64.657842][  T203] systemd-udevd/203 is trying to acquire lock:
> [   64.663589][  T203] f5835900 (&sb->s_type->i_lock_key){+.+.}-{3:3}, at: igrab+0x44/0xc0
> [   64.669221][  T203]
> [   64.669221][  T203] but task is already holding lock:
> [   64.669221][  T203]
> [   64.669221][  T203] but task is already holding lock:
> [   64.669221][  T203]
> [   64.669221][  T203] but task is already holding lock:
> [   64.674183][  T203] f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
> [   64.679737][  T203]
> [   64.679737][  T203] which lock already depends on the new lock.
> [   64.679737][  T203]
> [   64.679737][  T203] which lock already depends on the new lock.
> [   64.679737][  T203]
> [   64.679737][  T203] which lock already depends on the new lock.
> [   64.679737][  T203]
> [   64.686427][  T203]
> [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> [   64.686427][  T203]
> [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> [   64.686427][  T203]
> [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> [   64.691963][  T203]
> [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> [   64.691963][  T203]
> [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> [   64.691963][  T203]
> [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> [   64.695874][  T203]        _raw_spin_lock+0x26/0x40
> [   64.699072][  T203]        list_lru_add_obj+0x3c/0xc0
> [   64.702561][  T203]        d_lru_add+0x40/0x80
> [   64.705640][  T203]        fast_dput+0x1c7/0x200
> [   64.708794][  T203]        dput+0x25/0x40
> [   64.711603][  T203]        pick_link+0x1ed/0x340
> [   64.714612][  T203]        step_into_slowpath+0x1af/0x200
> [   64.718143][  T203]        path_lookupat+0x109/0x1c0
> [   64.721512][  T203]        filename_lookup+0xc1/0x200
> [   64.725044][  T203]        user_path_at+0x2f/0xc0
> [   64.728522][  T203]        __ia32_sys_mount+0x134/0x1c0
> [   64.732025][  T203]        ia32_sys_call+0x39/0x14c0
> [   64.735800][  T203]        __do_fast_syscall_32+0x16c/0x340
> [   64.740069][  T203]        do_fast_syscall_32+0x28/0x80
> [   64.743715][  T203]        do_SYSENTER_32+0x12/0x40
> [   64.747337][  T203]        entry_SYSENTER_32+0x98/0xfd
> [   64.750971][  T203]
> [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> [   64.750971][  T203]
> [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> [   64.750971][  T203]
> [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> [   64.756528][  T203]        _raw_spin_lock+0x26/0x40
> [   64.760072][  T203]        d_instantiate+0x34/0x80
> [   64.763562][  T203]        d_make_root+0x29/0x40
> [   64.766867][  T203]        shmem_fill_super+0x292/0x340
> [   64.770617][  T203]        get_tree_nodev+0x3e/0x80
> [   64.774112][  T203]        shmem_get_tree+0x12/0x40
> [   64.777728][  T203]        vfs_get_tree+0x1e/0xc0
> [   64.781170][  T203]        vfs_kern_mount+0x6e/0xc0
> [   64.784747][  T203]        kern_mount+0x16/0x40
> [   64.787998][  T203]        shmem_init+0x26/0x100
> [   64.791525][  T203]        mnt_init+0xfd/0x140
> [   64.794594][  T203]        vfs_caches_init+0x26/0x40
> [   64.798341][  T203]        start_kernel+0x2df/0x380
> [   64.801707][  T203]        i386_start_kernel+0xc5/0x100
> [   64.805611][  T203]        startup_32_smp+0x151/0x160
> [   64.809276][  T203]
> [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> [   64.809276][  T203]
> [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> [   64.809276][  T203]
> [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> [   64.815036][  T203]        __lock_acquire+0x1851/0x2a40
> [   64.818649][  T203]        lock_acquire+0x96/0x200
> [   64.821879][  T203]        _raw_spin_lock+0x26/0x40
> [   64.825139][  T203]        igrab+0x44/0xc0
> [   64.828067][  T203]        shmem_unused_huge_isolate+0x2e/0xc0
> [   64.832099][  T203]        __list_lru_walk_one+0x98/0x180
> [   64.835960][  T203]        list_lru_walk_node+0x1b/0x40
> [   64.839660][  T203]        shmem_unused_huge_shrink+0x62/0x500
> [   64.843880][  T203]        shmem_alloc_and_add_folio+0x1b8/0x480
> [   64.847901][  T203]        shmem_get_folio_gfp+0x1af/0x880
> [   64.851755][  T203]        shmem_write_begin+0x5c/0x100
> [   64.855571][  T203]        generic_perform_write+0xc1/0x340
> [   64.859545][  T203]        shmem_file_write_iter+0x5f/0x80
> [   64.863719][  T203]        vfs_write+0x263/0x340
> [   64.867230][  T203]        ksys_write+0x6a/0x100
> [   64.870798][  T203]        __ia32_sys_write+0x18/0x40
> [   64.874740][  T203]        ia32_sys_call+0x1365/0x14c0
> [   64.878135][  T203]        __do_fast_syscall_32+0x16c/0x340
> [   64.881546][  T203]        do_fast_syscall_32+0x28/0x80
> [   64.885606][  T203]        do_SYSENTER_32+0x12/0x40
> [   64.889087][  T203]        entry_SYSENTER_32+0x98/0xfd
> [   64.892908][  T203]
> [   64.892908][  T203] other info that might help us debug this:
> [   64.892908][  T203]
> [   64.892908][  T203] other info that might help us debug this:
> [   64.892908][  T203]
> [   64.892908][  T203] other info that might help us debug this:
> [   64.892908][  T203]
> [   64.900253][  T203] Chain exists of:
> [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> [   64.900253][  T203]
> [   64.900253][  T203] Chain exists of:
> [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> [   64.900253][  T203]
> [   64.900253][  T203] Chain exists of:
> [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> [   64.900253][  T203]
> [   64.909551][  T203]  Possible unsafe locking scenario:
> [   64.909551][  T203]
> [   64.909551][  T203]  Possible unsafe locking scenario:
> [   64.909551][  T203]
> [   64.909551][  T203]  Possible unsafe locking scenario:
> [   64.909551][  T203]
> [   64.915049][  T203]        CPU0                    CPU1
> [   64.918939][  T203]        ----                    ----
> [   64.922808][  T203]   lock(&l->lock);
> [   64.925634][  T203]                                lock(&lockref->lock);
> [   64.930586][  T203]                                lock(&l->lock);
> [   64.934913][  T203]   lock(&sb->s_type->i_lock_key);
> [   64.938686][  T203]
> [   64.938686][  T203]  *** DEADLOCK ***
> [   64.938686][  T203]
> [   64.938686][  T203]  *** DEADLOCK ***
> [   64.938686][  T203]
> [   64.938686][  T203]  *** DEADLOCK ***
> [   64.938686][  T203]
> [   64.944491][  T203] locks held by systemd-udevd/203: 4, last CPU#0:
> [   64.949046][  T203]  #0: f5c50a6c (sb_writers#6){.+.+}-{0:0}, at: vfs_write+0xb7/0x340
> [   64.954944][  T203]  #1: f5655658 (&sb->s_type->i_mutex_key#13){+.+.}-{4:4}, at: shmem_file_write_iter+0x28/0x80
> [   64.962274][  T203]  #2: f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
> [   64.968148][  T203]  #3: f5835810 (&info->lock){+.+.}-{3:3}, at: shmem_unused_huge_isolate+0x1f/0xc0
> [   64.974409][  T203]
> [   64.974409][  T203] stack backtrace:
> [   64.974409][  T203]
> [   64.974409][  T203] stack backtrace:
> [   64.974409][  T203]
> [   64.974409][  T203] stack backtrace:
> [   64.978786][  T203] CPU: 0 UID: 0 PID: 203 Comm: systemd-udevd Not tainted 7.3.0-rc4+ #1 PREEMPT  2f9698b0cc81084abb5f3c5754f76765d21e2bf0
> [   64.987668][  T203] Call Trace:
> [   64.990012][  T203]  __dump_stack+0x18/0x40
> [   64.993281][  T203]  dump_stack_lvl+0x20/0x40
> [   64.996699][  T203]  dump_stack+0xd/0x12
> [   64.999644][  T203]  print_circular_bug+0x2bf/0x300
> [   65.003228][  T203]  check_noncircular+0xd7/0x100
> [   65.006753][  T203]  __lock_acquire+0x1851/0x2a40
> [   65.009733][  T203]  ? _raw_spin_unlock_irqrestore+0x20/0x80
> [   65.013953][  T203]  lock_acquire+0x96/0x200
> [   65.017236][  T203]  ? igrab+0x44/0xc0
> [   65.020072][  T203]  _raw_spin_lock+0x26/0x40
> [   65.023308][  T203]  ? igrab+0x44/0xc0
> [   65.025972][  T203]  igrab+0x44/0xc0
> [   65.028647][  T203]  shmem_unused_huge_isolate+0x2e/0xc0
> [   65.032472][  T203]  __list_lru_walk_one+0x98/0x180
> [   65.035619][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
> [   65.039875][  T203]  list_lru_walk_node+0x1b/0x40
> [   65.043576][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
> [   65.047582][  T203]  shmem_unused_huge_shrink+0x62/0x500
> [   65.051774][  T203]  ? shmem_inode_acct_blocks+0x218/0x280
> [   65.055593][  T203]  shmem_alloc_and_add_folio+0x1b8/0x480
> [   65.059093][  T203]  shmem_get_folio_gfp+0x1af/0x880
> [   65.062996][  T203]  shmem_write_begin+0x5c/0x100
> [   65.066769][  T203]  generic_perform_write+0xc1/0x340
> [   65.070595][  T203]  shmem_file_write_iter+0x5f/0x80
> [   65.074058][  T203]  vfs_write+0x263/0x340
> [   65.077047][  T203]  ? shmem_file_read_iter+0x400/0x400
> [   65.081058][  T203]  ksys_write+0x6a/0x100
> [   65.084028][  T203]  __ia32_sys_write+0x18/0x40
> [   65.087227][  T203]  ia32_sys_call+0x1365/0x14c0
> [   65.090769][  T203]  __do_fast_syscall_32+0x16c/0x340
> [   65.094701][  T203]  ? do_fast_syscall_32+0x28/0x80
> [   65.098687][  T203]  do_fast_syscall_32+0x28/0x80
> [   65.102284][  T203]  do_SYSENTER_32+0x12/0x40
> [   65.105857][  T203]  entry_SYSENTER_32+0x98/0xfd
> [   65.109406][  T203] EIP: 0xa7fbbc4c
> [   65.112302][  T203] Code: c0 74 05 c1 e9 0c 89 08 31 c0 5e 5d 31 c9 31 d2 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 8d 76 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 58 b8
> [   65.127608][  T203] EAX: ffffffda EBX: 00000010 ECX: 0238cb60 EDX: 00000023
> [   65.133201][  T203] ESI: 00000023 EDI: 0238cb60 EBP: 0238a5e0 ESP: afef94f0
> [   65.138647][  T203] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00200246
> 
> 
> The kernel config and materials to reproduce are available at:
> https://download.01.org/0day-ci/archive/20261009/202610091403.d1d8080b-lkp@intel.com
> 
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests/wiki
> 


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

* Re: [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected
  2026-10-09  7:58 ` Qi Zheng
@ 2026-10-10  2:07   ` kernel test rebot
  2026-10-10 23:16   ` Andrew Morton
  1 sibling, 0 replies; 6+ messages in thread
From: kernel test rebot @ 2026-10-10  2:07 UTC (permalink / raw)
  To: Qi Zheng
  Cc: oe-lkp, lkp, Andrew Morton, Baolin Wang, Christian Brauner,
	David Hildenbrand, Hugh Dickins, Johannes Weiner, Michal Hocko,
	Muchun Song, Roman Gushchin, Shakeel Butt, Qinyun Tan, linux-mm

On Fri, Oct 09, 2026 at 03:58:46PM +0800, Qi Zheng wrote:
> Thanks for the report!
> 
> On 10/9/26 2:46 PM, kernel test robot wrote:
> > 
> > 
> > Hello,
> > 
> > kernel test robot noticed "WARNING:possible_circular_locking_dependency_detected" on:
> > 
> > commit: b9b1861d4f7ae63b15228c744d504a86ab48a5a2 ("mm: shmem: make unused huge shrinker memcg aware") https://git.kernel.org/cgit/linux/kernel/git/next/linux-next.git master
> > 
> > [test failed on linux-next/master f5f84daefcd92d7a630066635ecea1433ed5eac7]
> > 
> > in testcase: boot
> > 
> > config: i386-randconfig-053-20260902
> > compiler: clang-22
> > test machine: qemu-system-i386 -enable-kvm -cpu SandyBridge -smp 4 -m 4G
> > 
> > (please refer to attached dmesg/kmsg for entire log/backtrace)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <yi1.lai@intel.com>
> > | Closes: https://lore.kernel.org/oe-lkp/202610091403.d1d8080b-lkp@intel.com
> > 
> > [   64.638596][  T203] ======================================================
> > [   64.643742][  T203] WARNING: possible circular locking dependency detected
> > [   64.649127][  T203] 7.3.0-rc4+ #1 Not tainted
> > [   64.652392][  T203] ------------------------------------------------------
> 
> This does not look like an actual deadlock.  The list_lru lock held by
> shmem_unused_huge_isolate() belongs to the shmem unused huge shrinklist,
> while the existing dependency was recorded for the dentry LRU.  These
> are distinct lock instances.
> 
> However, both locks use the default list_lru lock class, so lockdep
> treats them as the same lock and combines their dependency chains.
> 
> Could you please help test whether the following change makes the
> lockdep warning go away?
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 5a9bcc7c66926..8ee767dccc1f6 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -5162,6 +5162,8 @@ static const struct dentry_operations 
> shmem_ci_dentry_ops = {
>   };
>   #endif
> 
> +static struct lock_class_key shmem_unused_huge_lock_key;
> +
>   static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
>   {
>          struct shmem_options *ctx = fc->fs_private;
> @@ -5243,7 +5245,8 @@ static int shmem_fill_super(struct super_block 
> *sb, struct fs_context *fc)
>                  goto failed;
> 
>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> -       if (list_lru_init_memcg(&sbinfo->shrinklist, sb->s_shrink))
> +       if (list_lru_init_memcg_key(&sbinfo->shrinklist, sb->s_shrink,
> +                                   &shmem_unused_huge_lock_key))
>                  goto failed;
>   #endif
>

Applied the fix on top of commit b9b1861d4f. The issue cannot be
reproduced.
 
> 
> Thanks,
> Qi
> 
> 
> > [   64.657842][  T203] systemd-udevd/203 is trying to acquire lock:
> > [   64.663589][  T203] f5835900 (&sb->s_type->i_lock_key){+.+.}-{3:3}, at: igrab+0x44/0xc0
> > [   64.669221][  T203]
> > [   64.669221][  T203] but task is already holding lock:
> > [   64.669221][  T203]
> > [   64.669221][  T203] but task is already holding lock:
> > [   64.669221][  T203]
> > [   64.669221][  T203] but task is already holding lock:
> > [   64.674183][  T203] f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
> > [   64.679737][  T203]
> > [   64.679737][  T203] which lock already depends on the new lock.
> > [   64.679737][  T203]
> > [   64.679737][  T203] which lock already depends on the new lock.
> > [   64.679737][  T203]
> > [   64.679737][  T203] which lock already depends on the new lock.
> > [   64.679737][  T203]
> > [   64.686427][  T203]
> > [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> > [   64.686427][  T203]
> > [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> > [   64.686427][  T203]
> > [   64.686427][  T203] the existing dependency chain (in reverse order) is:
> > [   64.691963][  T203]
> > [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> > [   64.691963][  T203]
> > [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> > [   64.691963][  T203]
> > [   64.691963][  T203] -> #2 (&l->lock){+.+.}-{3:3}:
> > [   64.695874][  T203]        _raw_spin_lock+0x26/0x40
> > [   64.699072][  T203]        list_lru_add_obj+0x3c/0xc0
> > [   64.702561][  T203]        d_lru_add+0x40/0x80
> > [   64.705640][  T203]        fast_dput+0x1c7/0x200
> > [   64.708794][  T203]        dput+0x25/0x40
> > [   64.711603][  T203]        pick_link+0x1ed/0x340
> > [   64.714612][  T203]        step_into_slowpath+0x1af/0x200
> > [   64.718143][  T203]        path_lookupat+0x109/0x1c0
> > [   64.721512][  T203]        filename_lookup+0xc1/0x200
> > [   64.725044][  T203]        user_path_at+0x2f/0xc0
> > [   64.728522][  T203]        __ia32_sys_mount+0x134/0x1c0
> > [   64.732025][  T203]        ia32_sys_call+0x39/0x14c0
> > [   64.735800][  T203]        __do_fast_syscall_32+0x16c/0x340
> > [   64.740069][  T203]        do_fast_syscall_32+0x28/0x80
> > [   64.743715][  T203]        do_SYSENTER_32+0x12/0x40
> > [   64.747337][  T203]        entry_SYSENTER_32+0x98/0xfd
> > [   64.750971][  T203]
> > [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> > [   64.750971][  T203]
> > [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> > [   64.750971][  T203]
> > [   64.750971][  T203] -> #1 (&lockref->lock){+.+.}-{3:3}:
> > [   64.756528][  T203]        _raw_spin_lock+0x26/0x40
> > [   64.760072][  T203]        d_instantiate+0x34/0x80
> > [   64.763562][  T203]        d_make_root+0x29/0x40
> > [   64.766867][  T203]        shmem_fill_super+0x292/0x340
> > [   64.770617][  T203]        get_tree_nodev+0x3e/0x80
> > [   64.774112][  T203]        shmem_get_tree+0x12/0x40
> > [   64.777728][  T203]        vfs_get_tree+0x1e/0xc0
> > [   64.781170][  T203]        vfs_kern_mount+0x6e/0xc0
> > [   64.784747][  T203]        kern_mount+0x16/0x40
> > [   64.787998][  T203]        shmem_init+0x26/0x100
> > [   64.791525][  T203]        mnt_init+0xfd/0x140
> > [   64.794594][  T203]        vfs_caches_init+0x26/0x40
> > [   64.798341][  T203]        start_kernel+0x2df/0x380
> > [   64.801707][  T203]        i386_start_kernel+0xc5/0x100
> > [   64.805611][  T203]        startup_32_smp+0x151/0x160
> > [   64.809276][  T203]
> > [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> > [   64.809276][  T203]
> > [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> > [   64.809276][  T203]
> > [   64.809276][  T203] -> #0 (&sb->s_type->i_lock_key){+.+.}-{3:3}:
> > [   64.815036][  T203]        __lock_acquire+0x1851/0x2a40
> > [   64.818649][  T203]        lock_acquire+0x96/0x200
> > [   64.821879][  T203]        _raw_spin_lock+0x26/0x40
> > [   64.825139][  T203]        igrab+0x44/0xc0
> > [   64.828067][  T203]        shmem_unused_huge_isolate+0x2e/0xc0
> > [   64.832099][  T203]        __list_lru_walk_one+0x98/0x180
> > [   64.835960][  T203]        list_lru_walk_node+0x1b/0x40
> > [   64.839660][  T203]        shmem_unused_huge_shrink+0x62/0x500
> > [   64.843880][  T203]        shmem_alloc_and_add_folio+0x1b8/0x480
> > [   64.847901][  T203]        shmem_get_folio_gfp+0x1af/0x880
> > [   64.851755][  T203]        shmem_write_begin+0x5c/0x100
> > [   64.855571][  T203]        generic_perform_write+0xc1/0x340
> > [   64.859545][  T203]        shmem_file_write_iter+0x5f/0x80
> > [   64.863719][  T203]        vfs_write+0x263/0x340
> > [   64.867230][  T203]        ksys_write+0x6a/0x100
> > [   64.870798][  T203]        __ia32_sys_write+0x18/0x40
> > [   64.874740][  T203]        ia32_sys_call+0x1365/0x14c0
> > [   64.878135][  T203]        __do_fast_syscall_32+0x16c/0x340
> > [   64.881546][  T203]        do_fast_syscall_32+0x28/0x80
> > [   64.885606][  T203]        do_SYSENTER_32+0x12/0x40
> > [   64.889087][  T203]        entry_SYSENTER_32+0x98/0xfd
> > [   64.892908][  T203]
> > [   64.892908][  T203] other info that might help us debug this:
> > [   64.892908][  T203]
> > [   64.892908][  T203] other info that might help us debug this:
> > [   64.892908][  T203]
> > [   64.892908][  T203] other info that might help us debug this:
> > [   64.892908][  T203]
> > [   64.900253][  T203] Chain exists of:
> > [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> > [   64.900253][  T203]
> > [   64.900253][  T203] Chain exists of:
> > [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> > [   64.900253][  T203]
> > [   64.900253][  T203] Chain exists of:
> > [   64.900253][  T203]   &sb->s_type->i_lock_key --> &lockref->lock --> &l->lock
> > [   64.900253][  T203]
> > [   64.909551][  T203]  Possible unsafe locking scenario:
> > [   64.909551][  T203]
> > [   64.909551][  T203]  Possible unsafe locking scenario:
> > [   64.909551][  T203]
> > [   64.909551][  T203]  Possible unsafe locking scenario:
> > [   64.909551][  T203]
> > [   64.915049][  T203]        CPU0                    CPU1
> > [   64.918939][  T203]        ----                    ----
> > [   64.922808][  T203]   lock(&l->lock);
> > [   64.925634][  T203]                                lock(&lockref->lock);
> > [   64.930586][  T203]                                lock(&l->lock);
> > [   64.934913][  T203]   lock(&sb->s_type->i_lock_key);
> > [   64.938686][  T203]
> > [   64.938686][  T203]  *** DEADLOCK ***
> > [   64.938686][  T203]
> > [   64.938686][  T203]  *** DEADLOCK ***
> > [   64.938686][  T203]
> > [   64.938686][  T203]  *** DEADLOCK ***
> > [   64.938686][  T203]
> > [   64.944491][  T203] locks held by systemd-udevd/203: 4, last CPU#0:
> > [   64.949046][  T203]  #0: f5c50a6c (sb_writers#6){.+.+}-{0:0}, at: vfs_write+0xb7/0x340
> > [   64.954944][  T203]  #1: f5655658 (&sb->s_type->i_mutex_key#13){+.+.}-{4:4}, at: shmem_file_write_iter+0x28/0x80
> > [   64.962274][  T203]  #2: f5c5a61c (&l->lock){+.+.}-{3:3}, at: __list_lru_walk_one+0x55/0x180
> > [   64.968148][  T203]  #3: f5835810 (&info->lock){+.+.}-{3:3}, at: shmem_unused_huge_isolate+0x1f/0xc0
> > [   64.974409][  T203]
> > [   64.974409][  T203] stack backtrace:
> > [   64.974409][  T203]
> > [   64.974409][  T203] stack backtrace:
> > [   64.974409][  T203]
> > [   64.974409][  T203] stack backtrace:
> > [   64.978786][  T203] CPU: 0 UID: 0 PID: 203 Comm: systemd-udevd Not tainted 7.3.0-rc4+ #1 PREEMPT  2f9698b0cc81084abb5f3c5754f76765d21e2bf0
> > [   64.987668][  T203] Call Trace:
> > [   64.990012][  T203]  __dump_stack+0x18/0x40
> > [   64.993281][  T203]  dump_stack_lvl+0x20/0x40
> > [   64.996699][  T203]  dump_stack+0xd/0x12
> > [   64.999644][  T203]  print_circular_bug+0x2bf/0x300
> > [   65.003228][  T203]  check_noncircular+0xd7/0x100
> > [   65.006753][  T203]  __lock_acquire+0x1851/0x2a40
> > [   65.009733][  T203]  ? _raw_spin_unlock_irqrestore+0x20/0x80
> > [   65.013953][  T203]  lock_acquire+0x96/0x200
> > [   65.017236][  T203]  ? igrab+0x44/0xc0
> > [   65.020072][  T203]  _raw_spin_lock+0x26/0x40
> > [   65.023308][  T203]  ? igrab+0x44/0xc0
> > [   65.025972][  T203]  igrab+0x44/0xc0
> > [   65.028647][  T203]  shmem_unused_huge_isolate+0x2e/0xc0
> > [   65.032472][  T203]  __list_lru_walk_one+0x98/0x180
> > [   65.035619][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
> > [   65.039875][  T203]  list_lru_walk_node+0x1b/0x40
> > [   65.043576][  T203]  ? shmem_unused_huge_shrink+0x500/0x500
> > [   65.047582][  T203]  shmem_unused_huge_shrink+0x62/0x500
> > [   65.051774][  T203]  ? shmem_inode_acct_blocks+0x218/0x280
> > [   65.055593][  T203]  shmem_alloc_and_add_folio+0x1b8/0x480
> > [   65.059093][  T203]  shmem_get_folio_gfp+0x1af/0x880
> > [   65.062996][  T203]  shmem_write_begin+0x5c/0x100
> > [   65.066769][  T203]  generic_perform_write+0xc1/0x340
> > [   65.070595][  T203]  shmem_file_write_iter+0x5f/0x80
> > [   65.074058][  T203]  vfs_write+0x263/0x340
> > [   65.077047][  T203]  ? shmem_file_read_iter+0x400/0x400
> > [   65.081058][  T203]  ksys_write+0x6a/0x100
> > [   65.084028][  T203]  __ia32_sys_write+0x18/0x40
> > [   65.087227][  T203]  ia32_sys_call+0x1365/0x14c0
> > [   65.090769][  T203]  __do_fast_syscall_32+0x16c/0x340
> > [   65.094701][  T203]  ? do_fast_syscall_32+0x28/0x80
> > [   65.098687][  T203]  do_fast_syscall_32+0x28/0x80
> > [   65.102284][  T203]  do_SYSENTER_32+0x12/0x40
> > [   65.105857][  T203]  entry_SYSENTER_32+0x98/0xfd
> > [   65.109406][  T203] EIP: 0xa7fbbc4c
> > [   65.112302][  T203] Code: c0 74 05 c1 e9 0c 89 08 31 c0 5e 5d 31 c9 31 d2 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 8d 76 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 90 58 b8
> > [   65.127608][  T203] EAX: ffffffda EBX: 00000010 ECX: 0238cb60 EDX: 00000023
> > [   65.133201][  T203] ESI: 00000023 EDI: 0238cb60 EBP: 0238a5e0 ESP: afef94f0
> > [   65.138647][  T203] DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 007b EFLAGS: 00200246
> > 
> > 
> > The kernel config and materials to reproduce are available at:
> > https://download.01.org/0day-ci/archive/20261009/202610091403.d1d8080b-lkp@intel.com
> > 
> > --
> > 0-DAY CI Kernel Test Service
> > https://github.com/intel/lkp-tests/wiki
> > 


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

* Re: [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected
  2026-10-09  7:58 ` Qi Zheng
  2026-10-10  2:07   ` kernel test rebot
@ 2026-10-10 23:16   ` Andrew Morton
  2026-10-11  4:50     ` Qi Zheng
  2026-10-11  4:59     ` [PATCH] mm: shmem: assign a lock class to the unused huge shrinklist Qi Zheng
  1 sibling, 2 replies; 6+ messages in thread
From: Andrew Morton @ 2026-10-10 23:16 UTC (permalink / raw)
  To: Qi Zheng
  Cc: kernel test robot, oe-lkp, lkp, Baolin Wang, Christian Brauner,
	David Hildenbrand, Hugh Dickins, Johannes Weiner, Michal Hocko,
	Muchun Song, Roman Gushchin, Shakeel Butt, Qinyun Tan, linux-mm

On Fri, 9 Oct 2026 15:58:46 +0800 "Qi Zheng" <zhengqi.arch@bytedance.com> wrote:

> Could you please help test whether the following change makes the
> lockdep warning go away?
> 
> diff --git a/mm/shmem.c b/mm/shmem.c
> index 5a9bcc7c66926..8ee767dccc1f6 100644
> --- a/mm/shmem.c
> +++ b/mm/shmem.c
> @@ -5162,6 +5162,8 @@ static const struct dentry_operations 
> shmem_ci_dentry_ops = {
>   };
>   #endif
> 
> +static struct lock_class_key shmem_unused_huge_lock_key;
> +

This could be local to shmem_fill_super().

And inside #ifdef CONFIG_TRANSPARENT_HUGEPAGE somehow.

>   static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
>   {
>          struct shmem_options *ctx = fc->fs_private;
> @@ -5243,7 +5245,8 @@ static int shmem_fill_super(struct super_block 
> *sb, struct fs_context *fc)
>                  goto failed;
> 
>   #ifdef CONFIG_TRANSPARENT_HUGEPAGE
> -       if (list_lru_init_memcg(&sbinfo->shrinklist, sb->s_shrink))
> +       if (list_lru_init_memcg_key(&sbinfo->shrinklist, sb->s_shrink,
> +                                   &shmem_unused_huge_lock_key))
>                  goto failed;
>   #endif
> 

Thanks, I'll await a formal (non-wordwrapped!) patch.


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

* Re: [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected
  2026-10-10 23:16   ` Andrew Morton
@ 2026-10-11  4:50     ` Qi Zheng
  2026-10-11  4:59     ` [PATCH] mm: shmem: assign a lock class to the unused huge shrinklist Qi Zheng
  1 sibling, 0 replies; 6+ messages in thread
From: Qi Zheng @ 2026-10-11  4:50 UTC (permalink / raw)
  To: Andrew Morton
  Cc: kernel test robot, oe-lkp, lkp, Baolin Wang, Christian Brauner,
	David Hildenbrand, Hugh Dickins, Johannes Weiner, Michal Hocko,
	Muchun Song, Roman Gushchin, Shakeel Butt, Qinyun Tan, linux-mm

Hi Andrew,

On 10/11/26 7:16 AM, Andrew Morton wrote:
> On Fri, 9 Oct 2026 15:58:46 +0800 "Qi Zheng" <zhengqi.arch@bytedance.com> wrote:
> 
>> Could you please help test whether the following change makes the
>> lockdep warning go away?
>>
>> diff --git a/mm/shmem.c b/mm/shmem.c
>> index 5a9bcc7c66926..8ee767dccc1f6 100644
>> --- a/mm/shmem.c
>> +++ b/mm/shmem.c
>> @@ -5162,6 +5162,8 @@ static const struct dentry_operations
>> shmem_ci_dentry_ops = {
>>    };
>>    #endif
>>
>> +static struct lock_class_key shmem_unused_huge_lock_key;
>> +
> 
> This could be local to shmem_fill_super().
> 
> And inside #ifdef CONFIG_TRANSPARENT_HUGEPAGE somehow.

Got it. Will do.

> 
>>    static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
>>    {
>>           struct shmem_options *ctx = fc->fs_private;
>> @@ -5243,7 +5245,8 @@ static int shmem_fill_super(struct super_block
>> *sb, struct fs_context *fc)
>>                   goto failed;
>>
>>    #ifdef CONFIG_TRANSPARENT_HUGEPAGE
>> -       if (list_lru_init_memcg(&sbinfo->shrinklist, sb->s_shrink))
>> +       if (list_lru_init_memcg_key(&sbinfo->shrinklist, sb->s_shrink,
>> +                                   &shmem_unused_huge_lock_key))
>>                   goto failed;
>>    #endif
>>
> 
> Thanks, I'll await a formal (non-wordwrapped!) patch.

OK, I'll send a formal fix patch soon.

Thanks,
Qi


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

* [PATCH] mm: shmem: assign a lock class to the unused huge shrinklist
  2026-10-10 23:16   ` Andrew Morton
  2026-10-11  4:50     ` Qi Zheng
@ 2026-10-11  4:59     ` Qi Zheng
  1 sibling, 0 replies; 6+ messages in thread
From: Qi Zheng @ 2026-10-11  4:59 UTC (permalink / raw)
  To: akpm, hughd, baolin.wang, usama.arif, yi1.lai
  Cc: linux-mm, linux-kernel, Qi Zheng

From: Qi Zheng <zhengqi.arch@bytedance.com>

The unused huge shrinklist shares the default list_lru lock class with the
dentry LRU.  Although they use distinct lock instances, lockdep conflates
their dependencies and reports a circular locking dependency:

	WARNING: possible circular locking dependency detected

Give the unused huge shrinklist a dedicated lock class to fix this
false-positive lockdep warning.

Fixes: b9b1861d4f7a ("mm: shmem: make unused huge shrinker memcg aware")
Reported-by: kernel test robot <yi1.lai@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202610091403.d1d8080b-lkp@intel.com
Signed-off-by: Qi Zheng <zhengqi.arch@bytedance.com>
---
 mm/shmem.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/mm/shmem.c b/mm/shmem.c
index 5a9bcc7c66926..a6e3c9c7f72da 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -5164,6 +5164,9 @@ static const struct dentry_operations shmem_ci_dentry_ops = {
 
 static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
 {
+#ifdef CONFIG_TRANSPARENT_HUGEPAGE
+	static struct lock_class_key shmem_unused_huge_lock_key;
+#endif
 	struct shmem_options *ctx = fc->fs_private;
 	struct inode *inode;
 	struct shmem_sb_info *sbinfo;
@@ -5243,7 +5246,8 @@ static int shmem_fill_super(struct super_block *sb, struct fs_context *fc)
 		goto failed;
 
 #ifdef CONFIG_TRANSPARENT_HUGEPAGE
-	if (list_lru_init_memcg(&sbinfo->shrinklist, sb->s_shrink))
+	if (list_lru_init_memcg_key(&sbinfo->shrinklist, sb->s_shrink,
+				    &shmem_unused_huge_lock_key))
 		goto failed;
 #endif
 
-- 
2.54.0



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

end of thread, other threads:[~2026-10-11  5:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-09  6:46 [linux-next:master] [mm] b9b1861d4f: WARNING:possible_circular_locking_dependency_detected kernel test robot
2026-10-09  7:58 ` Qi Zheng
2026-10-10  2:07   ` kernel test rebot
2026-10-10 23:16   ` Andrew Morton
2026-10-11  4:50     ` Qi Zheng
2026-10-11  4:59     ` [PATCH] mm: shmem: assign a lock class to the unused huge shrinklist Qi Zheng

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