Skip to contentSkip to conversation

2.6.10-mm3 scaling problem with inotify

DISCUSSION John Hawkes 1 participant 1 message Jan 14, 2005

lore
Share & tools
lore
#0 lore raw

I believe I've encountered a scaling problem with the inotify code in 2.6.10-mm3.

vfs_read() and vfs_write() (for example) do:

    dnotify_parent(dentry, DN_ACCESS);
    inotify_dentry_parent_queue_event(dentry,
                           IN_ACCESS, 0, dentry->d_name.name);
    inotify_inode_queue_event(inode, IN_ACCESS, 0, NULL);

for the optional "notify" functionality.

dnotify_parent() knows how to exit quickly:

       if (!dir_notify_enable)
                return;
looking at a global flag, and inotify_inode_queue_event() also knows a quick
exit:
        if (!inode->inotify_data)
                return;
However, inotify_dentry_parent_queue_event() first has to get the parent 
dentry:
        parent = dget_parent(dentry);
        inotify_inode_queue_event(parent->d_inode, mask, cookie, filename);
        dput(parent);

and, sadly, dget_parent(dentry) grabs a spinlock (dentry->d_lock) and dirties a cacheline (dentry->dcount). I have an AIM7-like workload that does numerous concurrent reads and suffers a 40% drop in performance because of this.

Is it possible for a parent's inode->inotify_data to be enabled when none of its children's inotify_data are enabled? That would make it easy - just look at the current inode's inotify_data before walking back to the parent.

John Hawkes