Messages in this thread | | | From | hooanon05@yahoo ... | Subject | Re: inotify limits - thousands (tens of thousands?) of watches | Date | Wed, 20 May 2009 22:58:26 +0900 |
| |
Marcin Krol: > I'm not a kernel programmer, but I want to develop a program that would > watch modifications in *all* user directories on a busy server using > inotify. ::: > 1. is it safe? that is, will it not lock the kernel up, or cause > excessive memory consumption? > > 2. is it economic in terms of CPU time and RAM? I have no idea how to > even measure such a thing happening in the kernel..
The maximum number of inotify instances per user is limited to /proc/sys/fs/inotify/max_user_instances which is 128 by default. And also the number of watches per user is limited by /proc/sys/fs/inotify/max_user_watches (8192 by defaut). Theoretically you may be able to monitor 8192 directories, but it consumes memory.
If periodical rsync is out of question for you, how about kprobe? While I don't think it is a beautiful solution, to set a hook to vfs_mkdir, vfs_unlink, etc and to compare the target super_block may work for you. See Documentation/kprobe.txt in detail.
J. R. Okajima
| |