From: Eryu Guan <guaneryu@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: jlayton@poochiereds.net, jack@suse.com
Subject: [BUG] inotify_add_watch/inotify_rm_watch loops trigger oom
Date: Sun, 14 Feb 2016 16:35:43 +0800 [thread overview]
Message-ID: <20160214083543.GC29898@eguan.usersys.redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 680 bytes --]
Hi,
Starting from v4.5-rc1 running inotify_add_watch/inotify_rm_watch in
loop could trigger OOM and system becomes unusuable. v4.4 kernel is fine
with the same stress test.
Reverting c510eff6beba ("fsnotify: destroy marks with call_srcu instead
of dedicated thread") on top of v4.5-rc3 passed the same test, seems
that this patch introduced some kind of memleak?
On v4.5-rc[1-3] the test program triggers oom within 10 minutes on my
test vm with 8G mem. After reverting the commit in question the same vm
survived more than 1 hour stress test.
./inotify <mnt>
I attached the test program and oom console log. If more information is
needed please let me know.
Thanks,
Eryu
[-- Attachment #2: inotify.c --]
[-- Type: text/plain, Size: 505 bytes --]
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdio.h>
#include <sys/inotify.h>
int main(int argc, char *argv[])
{
int notify_fd;
int wd, ret;
notify_fd = inotify_init();
for (;;) {
wd = inotify_add_watch(notify_fd, argv[1], IN_MODIFY | IN_CREATE | IN_DELETE );
if (wd < 0) {
perror("inotify_add_watch");
}
ret = inotify_rm_watch(notify_fd, wd);
if (ret < 0) {
perror("inotify_rm_watch");
}
}
out:
close(notify_fd);
return 0;
}
[-- Attachment #3: inotify-oom.log.bz2 --]
[-- Type: application/x-bzip2, Size: 7155 bytes --]
next reply other threads:[~2016-02-14 8:35 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-02-14 8:35 Eryu Guan [this message]
2016-02-14 14:39 ` [BUG] inotify_add_watch/inotify_rm_watch loops trigger oom Jeff Layton
2016-02-15 1:02 ` Paul E. McKenney
2016-02-15 1:24 ` Jeff Layton
2016-02-15 2:33 ` Linus Torvalds
2016-02-15 6:01 ` Paul E. McKenney
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=20160214083543.GC29898@eguan.usersys.redhat.com \
--to=guaneryu@gmail.com \
--cc=jack@suse.com \
--cc=jlayton@poochiereds.net \
--cc=linux-fsdevel@vger.kernel.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).