zeitgeist-datahub is calling inotify_add_watch() on .kde RecentDocuments every 4 seconds and failing
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
The Ubuntu Power Consumption Project |
New
|
High
|
Unassigned | ||
zeitgeist (Ubuntu) |
New
|
High
|
Unassigned |
Bug Description
zeitgeist-datahub is adding inotify_add_watch on /home/$
strace shows:
poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 3, 3998) = 0 (Timeout)
read(3, 0x7fffcfb823d0, 16) = -1 EAGAIN (Resource temporarily unavailable)
inotify_
poll([{fd=3, events=POLLIN}, {fd=7, events=POLLIN}, {fd=8, events=POLLIN}], 3, 3995) = 0 (Timeout)
read(3, 0x7fffcfb823d0, 16) = -1 EAGAIN (Resource temporarily unavailable)
inotify_
So clearly we have a ~4000 millesecond poll that times out followed by a inotify_add_watch on a directory that does not exist. I don't have any ~/.kde path to add the watch on to. So this seems a little bit wasteful to do this every 4 seconds.
Not sure about this, but the poll times out but we still do a read on fd 3, which is clearly not in a read state because the poll timed out rather than indicating fd 3 is read to read, so perhaps this is a bug.
Anyhow, my points are:
1. Is the ~4000ms poll really required?
2. Is the read on fd 3 required considering we just poll'd on it and it does not indicated it is read to read
3. Why is a watch being added for a path that does not exist every 4 seconds?
Although these wakeups are infrequent, they still contribute to probably unnecessarily keeping the CPU from a deep C state and hence this wastes power.
OK, it's got worse in Trusty, now it's polling even more directories that don't exist:
inotify_ add_watch( 9, "/usr/local/ share/applicati ons", IN_MODIFY| IN_ATTRIB| IN_CLOSE_ WRITE|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) add_watch( 9, "/usr/share/ ubuntu/ applications" , IN_MODIFY| IN_ATTRIB| IN_CLOSE_ WRITE|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) add_watch( 9, "/home/ king/.kde/ share/apps/ RecentDocuments ", IN_MODIFY| IN_ATTRIB| IN_CLOSE_ WRITE|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_
inotify_
poll([{fd=10, events=POLLIN}, {fd=9, events=POLLIN}], 2, 3997) = 0 (Timeout)
Why does this have to be every 4 seconds? That's sucking power on an idle system.