Re: [PATCH 1/3] sysfs directory scaling: rbtree for dirent name lookups

From: Eric W. Biederman
Date: Tue Nov 03 2009 - 05:41:48 EST

Benjamin LaHaise <bcrl@xxxxxxxx> writes:

> Use an rbtree in sysfs_dirent to speed up file lookup times
> Systems with large numbers (tens of thousands and more) of network
> interfaces stress the sysfs code in ways that make the linear search for
> a name match take far too long. Avoid this by using an rbtree.

Please take a look at the cleanups_scaling branch at:

I haven't spent a lot of time on it but it is possible to get everything
except the rbtree without increasing the size of sysfs_dirent. Also we
don't need the both the rbtree and a linked list.

In particular see:
commit 50623bbb82da3bd1d596b9173a91ed1b5aa168b8
Author: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxxxxxxxxxx>
Date: Sat Oct 31 04:11:18 2009 -0700

sysfs: Sort sysfs directories by name hash.

This is a step in preparation for introducing a more efficient
data structure than a linked list for sysfs entries. By ordering
by name hash instead of by inode sysfs_lookup can be speeded
up as well as allowing restarting after seekdir.

Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>

Meanwhile back to pushing the most important ones for real.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at