In order to watch my home directory and all subdirectories recursively for 60 seconds:
$ inotifywatch -v -r -t 60 /path
You may get Failed to watch /path; upper limit on inotify watches reached!
error , which you can fix by rising limit, e.g. to 128k: # echo $[ 128*1024 ] | tee /proc/sys/fs/inotify/max_user_watches
This made me wonder:
What exact costs does having n inotify
watches bring?
I ask in both: concrete and asypthotic complexities costs (I didn't dig yet, what datastructures at which parts of kernel stack and how are hooked as implementation of inotify).
I mean : computational, memory, and other costs.
I imagine, those to be functions (giving concrete numbers in KiB, or estimates of cpu load (maybe there are some good benchmarks), or even asymptotic (e.g. "each io )) of :
- files/directories watched
- operations on files/directories performed
- lengths of inotify watches queues
but maybe I've missed something?
I didn't dig yet into architecture, but I wonder if does it affect operations on non watched inodes/directories/files/paths?
Similarily, how does it differ for fanotify
?