From: Eric Paris <eparis@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
Peter Zijlstra <peterz@infradead.org>,
balbir@linux.vnet.ibm.com,
Andrew Morton <akpm@linux-foundation.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
Eric Paris <eparis@redhat.com>,
linux-fsdevel <linux-fsdevel@vger.kernel.org>,
aviro@redhat.com
Subject: [PATCH] make inotify event handles use GFP_NOFS
Date: Wed, 18 Mar 2009 14:27:32 -0400 [thread overview]
Message-ID: <1237400852.26799.16.camel@localhost.localdomain> (raw)
I think this is a bandaide to shut up lockdep. I could either figure
out lockdep classes and figure out how to reclassify inotify locks since
I believe Nick is correct when he says inotify watches pin the inode in
core so memory pressure can't evict it. I don't want to do that as I
think the real fix is my next generation fsnotify which does zero
allocations under locks and so everything can be GFP_KERNEL. I'm
posting this as it is clearly safe and should fix the issue.
http://marc.info/?l=linux-kernel&m=123617147432377&w=2
includes a lockdep warning that shows while we are reclaiming FS memory
and inode may get evicted which generates an IN_IGNORED message. Half
of that code path already used GFP_NOFS but a second allocation to store
the filename was using GFP_KERNEL. As a precaution I also moved the
audit handle_event code path to use GFP_NOFS.
This is much the same as the precaution in f04b30de3c82528 which did
something similar.
Signed-off-by: Eric Paris <eparis@redhat.com>
---
fs/notify/inotify/inotify_user.c | 2 +-
kernel/auditfilter.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index bed766e..1634319 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -220,7 +220,7 @@ static struct inotify_kernel_event * kernel_event(s32 wd, u32 mask, u32 cookie,
rem = 0;
}
- kevent->name = kmalloc(len + rem, GFP_KERNEL);
+ kevent->name = kmalloc(len + rem, GFP_NOFS);
if (unlikely(!kevent->name)) {
kmem_cache_free(event_cachep, kevent);
return NULL;
diff --git a/kernel/auditfilter.c b/kernel/auditfilter.c
index fbf24d1..a3fa2c0 100644
--- a/kernel/auditfilter.c
+++ b/kernel/auditfilter.c
@@ -1028,7 +1028,7 @@ static void audit_update_watch(struct audit_parent *parent,
if (audit_enabled) {
struct audit_buffer *ab;
- ab = audit_log_start(NULL, GFP_KERNEL,
+ ab = audit_log_start(NULL, GFP_NOFS,
AUDIT_CONFIG_CHANGE);
audit_log_format(ab, "auid=%u ses=%u",
audit_get_loginuid(current),
@@ -1067,7 +1067,7 @@ static void audit_remove_parent_watches(struct audit_parent *parent)
e = container_of(r, struct audit_entry, rule);
if (audit_enabled) {
struct audit_buffer *ab;
- ab = audit_log_start(NULL, GFP_KERNEL,
+ ab = audit_log_start(NULL, GFP_NOFS,
AUDIT_CONFIG_CHANGE);
audit_log_format(ab, "auid=%u ses=%u",
audit_get_loginuid(current),
next reply other threads:[~2009-03-18 18:26 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-18 18:27 Eric Paris [this message]
2009-03-30 21:26 ` [PATCH] make inotify event handles use GFP_NOFS Andrew Morton
2009-03-30 21:33 ` Peter Zijlstra
2009-04-03 14:34 ` Peter Zijlstra
2009-04-03 14:56 ` eparis
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=1237400852.26799.16.camel@localhost.localdomain \
--to=eparis@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=aviro@redhat.com \
--cc=balbir@linux.vnet.ibm.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=peterz@infradead.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 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).