All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Weiner <hannes@cmpxchg.org>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: mmotm 2014-02-05 list_lru_add lockdep splat
Date: Fri, 7 Feb 2014 12:44:17 -0500	[thread overview]
Message-ID: <20140207174417.GF6963@cmpxchg.org> (raw)
In-Reply-To: <alpine.LSU.2.11.1402061413330.27968@eggly.anvils>

On Thu, Feb 06, 2014 at 02:18:24PM -0800, Hugh Dickins wrote:
> On Thu, 6 Feb 2014, Johannes Weiner wrote:
> > On Wed, Feb 05, 2014 at 07:50:10PM -0800, Hugh Dickins wrote:
> > > ======================================================
> > > [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
> > > 3.14.0-rc1-mm1 #1 Not tainted
> > > ------------------------------------------------------
> > > kswapd0/48 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
> > >  (&(&lru->node[i].lock)->rlock){+.+.-.}, at: [<ffffffff81117064>] list_lru_add+0x80/0xf4
> > > 
> > > s already holding:
> > >  (&(&mapping->tree_lock)->rlock){..-.-.}, at: [<ffffffff81108c63>] __remove_mapping+0x3b/0x12d
> > > which would create a new lock dependency:
> > >  (&(&mapping->tree_lock)->rlock){..-.-.} -> (&(&lru->node[i].lock)->rlock){+.+.-.}
> > 
> > Thanks for the report.  The first time I saw this on my own machine, I
> > misinterpreted it as a false positive (could have sworn the "possible
> > unsafe scenario" section looked different, too).
> > 
> > Looking at it again, there really is a deadlock scenario when the
> > shadow shrinker races with a page cache insertion or deletion and is
> > interrupted by the IO completion handler while holding the list_lru
> > lock:
> > 
> > >  Possible interrupt unsafe locking scenario:
> > > 
> > >        CPU0                    CPU1
> > >        ----                    ----
> > >   lock(&(&lru->node[i].lock)->rlock);
> > >                                local_irq_disable();
> > >                                lock(&(&mapping->tree_lock)->rlock);
> > >                                lock(&(&lru->node[i].lock)->rlock);
> > >   <Interrupt>
> > >     lock(&(&mapping->tree_lock)->rlock);
> > 
> > Could you please try with the following patch?
> 
> Sure, that fixes it for me (with one trivial correction appended), thanks.
> But don't imagine I've given it anything as demanding as thought!
>
> --- hannes/mm/list_lru.c	2014-02-06 08:50:25.104032277 -0800
> +++ hughd/mm/list_lru.c	2014-02-06 08:58:36.884043965 -0800
> @@ -143,7 +143,7 @@ int list_lru_init_key(struct list_lru *l
>  	}
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(list_lru_init);
> +EXPORT_SYMBOL_GPL(list_lru_init_key);
>  
>  void list_lru_destroy(struct list_lru *lru)
>  {

Oops, yes, I usually do non-modular builds.  Thanks, will merge this
into the above patch unless Andrew beats me to it.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: Johannes Weiner <hannes@cmpxchg.org>
To: Hugh Dickins <hughd@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: mmotm 2014-02-05 list_lru_add lockdep splat
Date: Fri, 7 Feb 2014 12:44:17 -0500	[thread overview]
Message-ID: <20140207174417.GF6963@cmpxchg.org> (raw)
In-Reply-To: <alpine.LSU.2.11.1402061413330.27968@eggly.anvils>

On Thu, Feb 06, 2014 at 02:18:24PM -0800, Hugh Dickins wrote:
> On Thu, 6 Feb 2014, Johannes Weiner wrote:
> > On Wed, Feb 05, 2014 at 07:50:10PM -0800, Hugh Dickins wrote:
> > > ======================================================
> > > [ INFO: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected ]
> > > 3.14.0-rc1-mm1 #1 Not tainted
> > > ------------------------------------------------------
> > > kswapd0/48 [HC0[0]:SC0[0]:HE0:SE1] is trying to acquire:
> > >  (&(&lru->node[i].lock)->rlock){+.+.-.}, at: [<ffffffff81117064>] list_lru_add+0x80/0xf4
> > > 
> > > s already holding:
> > >  (&(&mapping->tree_lock)->rlock){..-.-.}, at: [<ffffffff81108c63>] __remove_mapping+0x3b/0x12d
> > > which would create a new lock dependency:
> > >  (&(&mapping->tree_lock)->rlock){..-.-.} -> (&(&lru->node[i].lock)->rlock){+.+.-.}
> > 
> > Thanks for the report.  The first time I saw this on my own machine, I
> > misinterpreted it as a false positive (could have sworn the "possible
> > unsafe scenario" section looked different, too).
> > 
> > Looking at it again, there really is a deadlock scenario when the
> > shadow shrinker races with a page cache insertion or deletion and is
> > interrupted by the IO completion handler while holding the list_lru
> > lock:
> > 
> > >  Possible interrupt unsafe locking scenario:
> > > 
> > >        CPU0                    CPU1
> > >        ----                    ----
> > >   lock(&(&lru->node[i].lock)->rlock);
> > >                                local_irq_disable();
> > >                                lock(&(&mapping->tree_lock)->rlock);
> > >                                lock(&(&lru->node[i].lock)->rlock);
> > >   <Interrupt>
> > >     lock(&(&mapping->tree_lock)->rlock);
> > 
> > Could you please try with the following patch?
> 
> Sure, that fixes it for me (with one trivial correction appended), thanks.
> But don't imagine I've given it anything as demanding as thought!
>
> --- hannes/mm/list_lru.c	2014-02-06 08:50:25.104032277 -0800
> +++ hughd/mm/list_lru.c	2014-02-06 08:58:36.884043965 -0800
> @@ -143,7 +143,7 @@ int list_lru_init_key(struct list_lru *l
>  	}
>  	return 0;
>  }
> -EXPORT_SYMBOL_GPL(list_lru_init);
> +EXPORT_SYMBOL_GPL(list_lru_init_key);
>  
>  void list_lru_destroy(struct list_lru *lru)
>  {

Oops, yes, I usually do non-modular builds.  Thanks, will merge this
into the above patch unless Andrew beats me to it.

  reply	other threads:[~2014-02-07 17:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-06  3:50 mmotm 2014-02-05 list_lru_add lockdep splat Hugh Dickins
2014-02-06  3:50 ` Hugh Dickins
2014-02-06 16:41 ` Johannes Weiner
2014-02-06 16:41   ` Johannes Weiner
2014-02-06 22:18   ` Hugh Dickins
2014-02-06 22:18     ` Hugh Dickins
2014-02-07 17:44     ` Johannes Weiner [this message]
2014-02-07 17:44       ` Johannes Weiner
2014-02-07 20:52   ` Andrew Morton
2014-02-07 20:52     ` Andrew Morton
2014-02-09 18:29     ` Johannes Weiner
2014-02-09 18:29       ` Johannes Weiner

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=20140207174417.GF6963@cmpxchg.org \
    --to=hannes@cmpxchg.org \
    --cc=akpm@linux-foundation.org \
    --cc=hughd@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.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 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.