linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matthew Wilcox <willy@infradead.org>
To: "Liam R. Howlett" <Liam.Howlett@oracle.com>,
	Peng Zhang <zhangpeng.00@bytedance.com>,
	kernel test robot <oliver.sang@intel.com>,
	oe-lkp@lists.linux.dev, lkp@intel.com,
	maple-tree@lists.infradead.org, linux-mm@kvack.org,
	corbet@lwn.net, akpm@linux-foundation.org, brauner@kernel.org,
	surenb@google.com, michael.christie@oracle.com,
	peterz@infradead.org, mathieu.desnoyers@efficios.com,
	npiggin@gmail.com, avagin@gmail.com, linux-doc@vger.kernel.org,
	linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org
Subject: Re: [PATCH v2 5/6] maple_tree: Update check_forking() and bench_forking()
Date: Thu, 7 Sep 2023 19:16:36 +0100	[thread overview]
Message-ID: <ZPoThAU9zoW2q/YR@casper.infradead.org> (raw)
In-Reply-To: <20230907180301.lms4ihtwfuwj7bkb@revolver>

On Thu, Sep 07, 2023 at 02:03:01PM -0400, Liam R. Howlett wrote:
> > >  WARNING: possible recursive locking detected
> > >  6.5.0-rc4-00632-g2730245bd6b1 #1 Tainted: G                TN
> > >  --------------------------------------------
> > >  swapper/1 is trying to acquire lock:
> > > ffffffff86485058 (&mt->ma_lock){+.+.}-{2:2}, at: check_forking (include/linux/spinlock.h:? lib/test_maple_tree.c:1854)
> > > 
> > >  but task is already holding lock:
> > >  ffff888110847a30 (&mt->ma_lock){+.+.}-{2:2}, at: check_forking (include/linux/spinlock.h:351 lib/test_maple_tree.c:1854)
> > Thanks for the test. I checked that these are two different locks, why
> > is this warning reported? Did I miss something?
> 
> I don't think you can nest spinlocks like this.  In my previous test I
> avoided nesting, but in your case we cannot avoid having both locks at
> the same time.
> 
> You can get around this by using an rwsemaphore, set the two trees as
> external and use down_write_nested(&lock2, SINGLE_DEPTH_NESTING) like
> the real fork.  Basically, switch the locking to exactly what fork does.

spin_lock_nested() exists.

You should probably both read through
Documentation/locking/lockdep-design.rst It's not the best user
documentation in the world, but it's what we have.

  reply	other threads:[~2023-09-07 18:17 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-30 12:56 [PATCH v2 0/6] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-08-30 12:56 ` [PATCH v2 1/6] maple_tree: Add two helpers Peng Zhang
2023-09-07 20:13   ` Liam R. Howlett
2023-09-08  2:45     ` Peng Zhang
2023-08-30 12:56 ` [PATCH v2 2/6] maple_tree: Introduce interfaces __mt_dup() and mtree_dup() Peng Zhang
2023-09-07 20:13   ` Liam R. Howlett
2023-09-08  9:26     ` Peng Zhang
2023-09-08 16:05       ` Liam R. Howlett
2023-09-11 12:59     ` Peng Zhang
2023-09-11 13:36       ` Liam R. Howlett
2023-08-30 12:56 ` [PATCH v2 3/6] maple_tree: Add test for mtree_dup() Peng Zhang
2023-09-07 20:13   ` Liam R. Howlett
2023-09-08  9:38     ` Peng Zhang
2023-09-25  4:06     ` Peng Zhang
2023-09-25  7:44       ` Liam R. Howlett
2023-09-25  8:30         ` Peng Zhang
2023-08-30 12:56 ` [PATCH v2 4/6] maple_tree: Skip other tests when BENCH is enabled Peng Zhang
2023-08-30 12:56 ` [PATCH v2 5/6] maple_tree: Update check_forking() and bench_forking() Peng Zhang
2023-08-31 13:40   ` kernel test robot
2023-09-01 10:58     ` Peng Zhang
2023-09-07 18:03       ` Liam R. Howlett
2023-09-07 18:16         ` Matthew Wilcox [this message]
2023-09-08  9:47           ` Peng Zhang
2023-09-07 20:14   ` Liam R. Howlett
2023-08-30 12:56 ` [PATCH v2 6/6] fork: Use __mt_dup() to duplicate maple tree in dup_mmap() Peng Zhang
2023-09-07 20:14   ` Liam R. Howlett
2023-09-08  9:58     ` Peng Zhang
2023-09-08 16:07       ` Liam R. Howlett
2023-09-15 10:51     ` Peng Zhang
2023-09-15 10:56       ` Peng Zhang
2023-09-15 20:00         ` Liam R. Howlett
2023-09-18 13:14           ` Peng Zhang
2023-09-18 17:59             ` Liam R. Howlett
2023-08-30 13:05 ` [PATCH v2 0/6] Introduce __mt_dup() to improve the performance of fork() Peng Zhang
2023-09-07 20:19 ` Liam R. Howlett

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=ZPoThAU9zoW2q/YR@casper.infradead.org \
    --to=willy@infradead.org \
    --cc=Liam.Howlett@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=avagin@gmail.com \
    --cc=brauner@kernel.org \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=lkp@intel.com \
    --cc=maple-tree@lists.infradead.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=michael.christie@oracle.com \
    --cc=npiggin@gmail.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oliver.sang@intel.com \
    --cc=peterz@infradead.org \
    --cc=surenb@google.com \
    --cc=zhangpeng.00@bytedance.com \
    /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;
as well as URLs for NNTP newsgroup(s).