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
#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:
inotify-oom.log.bz2
Description: BZip2 compressed data