Bug 248054 - wasteful calls to inotify_add_watch
Summary: wasteful calls to inotify_add_watch
Keywords:
Status: CLOSED DUPLICATE of bug 240385
Alias: None
Product: Fedora
Classification: Fedora
Component: gnome-menus
Version: 7
Hardware: All
OS: Linux
low
low
Target Milestone: ---
Assignee: Ray Strode [halfline]
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2007-07-12 20:19 UTC by Dave Jones
Modified: 2015-01-04 22:29 UTC (History)
1 user (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2007-07-25 02:46:35 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Dave Jones 2007-07-12 20:19:22 UTC
Something (I'm assuming gnome menus has something to do with this based upon the
filenames) is trying to continuously add inotify watches on files that don't
exist.   strace -p `pidof gam_server` shows this ..

inotify_add_watch(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
poll([{fd=4, events=0}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8,
events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=4,
events=POLLIN}, {fd=3, events=POLLIN}], 8, 3999) = 0
poll([{fd=4, events=0}, {fd=5, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8,
events=POLLIN}, {fd=9, events=POLLIN}, {fd=10, events=POLLIN}, {fd=4,
events=POLLIN}, {fd=3, events=POLLIN}], 8, 0) = 0
inotify_add_watch(3, "/home/davej/.config/menus/gnome-screensavers-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/etc/xdg/menus/gnome-screensavers-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus/server-settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/etc/xdg/menus/server-settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus/system-settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/etc/xdg/menus/system-settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus/preferences-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus/settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/etc/xdg/menus/settings-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus/applications-merged",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)
inotify_add_watch(3, "/home/davej/.config/menus",
IN_MODIFY|IN_ATTRIB|IN_MOVED_FROM|IN_MOVED_TO|IN_CREATE|IN_DELETE|IN_DELETE_SELF|IN_MOVE_SELF|IN_UNMOUNT|IN_ONLYDIR)
= -1 ENOENT (No such file or directory)


This could be a lot less work if it just checked for ~/.config first and not
bothering with all the subsequent calls.

Better yet would be for this to be a single inotify watch on $HOME to watch for
the creation of a .config, and only then start doing this polling.

Comment 1 Ray Strode [halfline] 2007-07-12 20:36:20 UTC
I think this is a duplicate of an existing open bug report (Peter filed it I
think?).

Anyway, yea we should definitely watch .config and only add the watches when the
directories are around.

I don't think watching $HOME would be good.  it gets so much activity there
would be a lot of spurious wakeups, no?

Comment 2 Dave Jones 2007-07-15 21:37:27 UTC
If you're only watching for IN_CREATE activity, there'll not be /that/ much
activity. Sure most of it will be unrelated to what we're watching for, but it's
still going to be a lot lower overhead than what we're doing now, by changing
from a constant "did something happen?" loop to a "something happened, did we
care?" event model.

Comment 3 Ray Strode [halfline] 2007-07-18 14:31:10 UTC
Right, I'm just saying we should watch in ~/.config (which should always be
around, and hardly ever changes) instead of watching ~ which changes all the time.

(I think that's what you suggested in the second to last paragraph?)

Retitling for now, I may mark this as a duplicate if I can find the other report.

Comment 4 Matthias Clasen 2007-07-25 02:46:35 UTC

*** This bug has been marked as a duplicate of 240385 ***


Note You need to log in before you can comment on or make changes to this bug.