Re: 2.6.10-mm3 scaling problem with inotify

From: Robert Love
Date: Thu Jan 13 2005 - 21:32:14 EST


On Thu, 2005-01-13 at 20:31 -0500, John McCutchan wrote:

> No, you covered things well. This code was really just a straight copy
> of the dnotify code. Rob cleaned it up at some point, giving us what we
> have today. The only fix I can think of is the one suggested by Rob --
> copying the dnotify code again.

Oh, did I undo the dnotify optimization? :-)

Eh, no, looks like not exactly: The old code always did a dget().

John Hawkes: Attached patch implements the dget() optimization in the
same manner as dnotify. Compile-tested but not booted.

Let me know!

Robert Love


inotify: don't do dget() unless we have to

drivers/char/inotify.c | 14 +++++++++++---
1 files changed, 11 insertions(+), 3 deletions(-)

diff -urN linux-2.6.10-mm3/drivers/char/inotify.c linux/drivers/char/inotify.c
--- linux-2.6.10-mm3/drivers/char/inotify.c 2005-01-13 21:04:53.108971856 -0500
+++ linux/drivers/char/inotify.c 2005-01-13 21:25:20.052448096 -0500
@@ -607,10 +607,18 @@
u32 cookie, const char *filename)
{
struct dentry *parent;
+ struct inode *inode;

- parent = dget_parent(dentry);
- inotify_inode_queue_event(parent->d_inode, mask, cookie, filename);
- dput(parent);
+ spin_lock(&dentry->d_lock);
+ parent = dentry->d_parent;
+ inode = parent->d_inode;
+ if (inode->inotify_data) {
+ dget(parent);
+ spin_unlock(&dentry->d_lock);
+ inotify_inode_queue_event(inode, mask, cookie, filename);
+ dput(parent);
+ } else
+ spin_unlock(&dentry->d_lock);
}
EXPORT_SYMBOL_GPL(inotify_dentry_parent_queue_event);



-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/