All of lore.kernel.org
 help / color / mirror / Atom feed
From: Wu Fengguang <fengguang.wu@intel.com>
To: Eric Paris <eparis@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Matt Mackall <mpm@selenic.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] use GFP_NOFS in kernel_event()
Date: Thu, 30 Apr 2009 22:03:24 +0800	[thread overview]
Message-ID: <20090430140324.GA12033@localhost> (raw)
In-Reply-To: <20090430134821.GB8644@localhost>

On Thu, Apr 30, 2009 at 09:48:21PM +0800, Wu Fengguang wrote:
> On Thu, Apr 30, 2009 at 09:19:33PM +0800, Eric Paris wrote:
> > inotify: lockdep annotation when watch being removed
> > 
> > From: Eric Paris <eparis@redhat.com>
> > 
> > When a dentry is being evicted from memory pressure, if the inode associated
> > with that dentry has i_nlink == 0 we are going to drop all of the watches and
> > kick everything out.  Lockdep complains that previously holding inotify_mutex
> > we did a __GFP_FS allocation and now __GFP_FS reclaim is taking that lock.
> > There is no deadlock or danger, since we know on this code path we are
> > actually cleaning up and evicting everything.  So we move the lock into a new
> > class for clean up.
> 
> I can reproduce the bug and hence confirm that this patch works, so
> 
> Tested-by: Wu Fengguang <fengguang.wu@intel.com>

btw, I really see no point to have one GFP_KERNEL and one GFP_NOFS
sitting side by side inside kernel_event(). So this patch?

---
inotify: use consistent GFP_KERNEL in kernel_event()

kernel_event() has side by side kmem_cache_alloc(GFP_NOFS)
and kmalloc(GFP_KERNEL). Change to consistent GFP_KERNELs.

cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 fs/notify/inotify/inotify_user.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- mm.orig/fs/notify/inotify/inotify_user.c
+++ mm/fs/notify/inotify/inotify_user.c
@@ -189,7 +189,7 @@ static struct inotify_kernel_event * ker
 {
 	struct inotify_kernel_event *kevent;
 
-	kevent = kmem_cache_alloc(event_cachep, GFP_NOFS);
+	kevent = kmem_cache_alloc(event_cachep, GFP_KERNEL);
 	if (unlikely(!kevent))
 		return NULL;
 

WARNING: multiple messages have this Message-ID (diff)
From: Wu Fengguang <fengguang.wu@intel.com>
To: Eric Paris <eparis@redhat.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>,
	Matt Mackall <mpm@selenic.com>,
	Christoph Lameter <cl@linux-foundation.org>,
	Ingo Molnar <mingo@elte.hu>, Al Viro <viro@zeniv.linux.org.uk>
Subject: Re: [PATCH] use GFP_NOFS in kernel_event()
Date: Thu, 30 Apr 2009 22:03:24 +0800	[thread overview]
Message-ID: <20090430140324.GA12033@localhost> (raw)
In-Reply-To: <20090430134821.GB8644@localhost>

On Thu, Apr 30, 2009 at 09:48:21PM +0800, Wu Fengguang wrote:
> On Thu, Apr 30, 2009 at 09:19:33PM +0800, Eric Paris wrote:
> > inotify: lockdep annotation when watch being removed
> > 
> > From: Eric Paris <eparis@redhat.com>
> > 
> > When a dentry is being evicted from memory pressure, if the inode associated
> > with that dentry has i_nlink == 0 we are going to drop all of the watches and
> > kick everything out.  Lockdep complains that previously holding inotify_mutex
> > we did a __GFP_FS allocation and now __GFP_FS reclaim is taking that lock.
> > There is no deadlock or danger, since we know on this code path we are
> > actually cleaning up and evicting everything.  So we move the lock into a new
> > class for clean up.
> 
> I can reproduce the bug and hence confirm that this patch works, so
> 
> Tested-by: Wu Fengguang <fengguang.wu@intel.com>

btw, I really see no point to have one GFP_KERNEL and one GFP_NOFS
sitting side by side inside kernel_event(). So this patch?

---
inotify: use consistent GFP_KERNEL in kernel_event()

kernel_event() has side by side kmem_cache_alloc(GFP_NOFS)
and kmalloc(GFP_KERNEL). Change to consistent GFP_KERNELs.

cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Wu Fengguang <fengguang.wu@intel.com>
---
 fs/notify/inotify/inotify_user.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- mm.orig/fs/notify/inotify/inotify_user.c
+++ mm/fs/notify/inotify/inotify_user.c
@@ -189,7 +189,7 @@ static struct inotify_kernel_event * ker
 {
 	struct inotify_kernel_event *kevent;
 
-	kevent = kmem_cache_alloc(event_cachep, GFP_NOFS);
+	kevent = kmem_cache_alloc(event_cachep, GFP_KERNEL);
 	if (unlikely(!kevent))
 		return NULL;
 

--
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-04-30 14:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-04-30  2:00 [PATCH] use GFP_NOFS in kernel_event() Wu Fengguang
2009-04-30  2:00 ` Wu Fengguang
2009-04-30  2:10 ` Andrew Morton
2009-04-30  2:10   ` Andrew Morton
2009-04-30 13:19   ` Eric Paris
2009-04-30 13:19     ` Eric Paris
2009-04-30 13:48     ` Wu Fengguang
2009-04-30 13:48       ` Wu Fengguang
2009-04-30 14:03       ` Wu Fengguang [this message]
2009-04-30 14:03         ` Wu Fengguang
2009-04-30 14:06         ` Ingo Molnar
2009-04-30 14:06           ` Ingo Molnar
2009-04-30 14:28       ` Wu Fengguang
2009-04-30 14:28         ` Wu Fengguang
2009-04-30 14:52         ` Eric Paris
2009-04-30 14:52           ` Eric Paris
2009-05-02  2:25           ` Wu Fengguang
2009-05-02  2:25             ` Wu Fengguang
2009-05-02  8:04             ` Wu Fengguang
2009-05-02  8:04               ` Wu Fengguang
2009-05-02 15:11               ` Eric Paris
2009-05-02 15:11                 ` Eric Paris
2009-04-30 21:10     ` Andrew Morton
2009-04-30 21:10       ` Andrew Morton
2009-05-01 18:11       ` Eric Paris
2009-05-01 18:11         ` Eric Paris
2009-05-01 20:28         ` Andrew Morton
2009-05-01 20:28           ` Andrew Morton
2009-05-05 12:43     ` Nick Piggin
2009-05-05 12:43       ` Nick Piggin

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=20090430140324.GA12033@localhost \
    --to=fengguang.wu@intel.com \
    --cc=akpm@linux-foundation.org \
    --cc=cl@linux-foundation.org \
    --cc=eparis@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@elte.hu \
    --cc=mpm@selenic.com \
    --cc=viro@zeniv.linux.org.uk \
    /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.