Re: [PATCH] sysfs: Cache the last sysfs_dirent to improve readdirscalability

From: Borislav Petkov
Date: Fri Jan 01 2010 - 10:34:13 EST


On Fri, Jan 01, 2010 at 05:58:00AM -0800, Eric W. Biederman wrote:
>
> When sysfs_readdir stops short we now cache the next sysfs_dirent to
> return to user space in filp->private_data. There is no impact on the
> rest of sysfs by doing this and in the common case it allows us to
> pick up exactly where we left off with no seeking.
>
> Additionally I drop and regrab the sysfs_mutex around filldir to avoid
> a page fault arbitrarily increasing the hold time on the sysfs_mutex.
>
> Signed-off-by: Eric W. Biederman <ebiederm@xxxxxxxxxxxxxxxxxx>
> ---
>
> I haven't stressed this patch but it is sound in principle, and is a
> general sysfs improvement, regardless of any locking issues.

I've slapped it ontop of v2.6.33-rc2-249-gcd6e125 here and the circular
locking warning is gone. I'll keep an eye on it in the next couple of
days, just in case.

Tested-by: Borislav Petkov <petkovbb@xxxxxxxxx>

--
Regards/Gruss,
Boris.
--
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/