All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: kamezawa.hiroyu@jp.fujitsu.com, balbir@in.ibm.com,
	nishimura@mxp.nes.nec.co.jp, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org
Subject: Re: [BUGFIX][PATCH] memcg: fix deadlock between lock_page_cgroup and mapping tree_lock
Date: Wed, 13 May 2009 11:56:26 -0700	[thread overview]
Message-ID: <20090513115626.57844f28.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090513133031.f4be15a8.nishimura@mxp.nes.nec.co.jp>

On Wed, 13 May 2009 13:30:31 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> mapping->tree_lock can be aquired from interrupt context.
> Then, following dead lock can occur.
> 
> Assume "A" as a page.
> 
>  CPU0:
>        lock_page_cgroup(A)
> 		interrupted
> 			-> take mapping->tree_lock.
>  CPU1:
>        take mapping->tree_lock
> 		-> lock_page_cgroup(A)

And we didn't find out about this because lock_page_cgroup() uses
bit_spin_lock(), and lockdep doesn't handle bit_spin_lock().

It would perhaps be useful if one of you guys were to add a spinlock to
struct page, convert lock_page_cgroup() to use that spinlock then run a
full set of tests under lockdep, see if it can shake out any other bugs.


WARNING: multiple messages have this Message-ID (diff)
From: Andrew Morton <akpm@linux-foundation.org>
To: Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp>
Cc: kamezawa.hiroyu@jp.fujitsu.com, balbir@in.ibm.com,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: Re: [BUGFIX][PATCH] memcg: fix deadlock between lock_page_cgroup and mapping tree_lock
Date: Wed, 13 May 2009 11:56:26 -0700	[thread overview]
Message-ID: <20090513115626.57844f28.akpm@linux-foundation.org> (raw)
In-Reply-To: <20090513133031.f4be15a8.nishimura@mxp.nes.nec.co.jp>

On Wed, 13 May 2009 13:30:31 +0900
Daisuke Nishimura <nishimura@mxp.nes.nec.co.jp> wrote:

> mapping->tree_lock can be aquired from interrupt context.
> Then, following dead lock can occur.
> 
> Assume "A" as a page.
> 
>  CPU0:
>        lock_page_cgroup(A)
> 		interrupted
> 			-> take mapping->tree_lock.
>  CPU1:
>        take mapping->tree_lock
> 		-> lock_page_cgroup(A)

And we didn't find out about this because lock_page_cgroup() uses
bit_spin_lock(), and lockdep doesn't handle bit_spin_lock().

It would perhaps be useful if one of you guys were to add a spinlock to
struct page, convert lock_page_cgroup() to use that spinlock then run a
full set of tests under lockdep, see if it can shake out any other bugs.

--
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>

  reply	other threads:[~2009-05-13 19:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-13  4:30 [BUGFIX][PATCH] memcg: fix deadlock between lock_page_cgroup and mapping tree_lock Daisuke Nishimura
2009-05-13  4:30 ` Daisuke Nishimura
2009-05-13 18:56 ` Andrew Morton [this message]
2009-05-13 18:56   ` Andrew Morton
2009-05-13 23:44   ` KAMEZAWA Hiroyuki
2009-05-13 23:44     ` KAMEZAWA Hiroyuki
2009-05-14  1:48   ` [BUGFIX][PATCH] memcg: fix deadlock between lock_page_cgroupand " Balbir Singh
2009-05-14  1:48     ` Balbir Singh

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=20090513115626.57844f28.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=balbir@in.ibm.com \
    --cc=kamezawa.hiroyu@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=nishimura@mxp.nes.nec.co.jp \
    /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.