diff options
author | Theodore Ts'o <tytso@mit.edu> | 2009-04-27 17:33:23 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2009-04-27 17:33:23 -0400 |
commit | 8b0f9e8f78bd0a65fa001bf18f2c47eef2893a10 (patch) | |
tree | f97cd42eb0cf5c20e260c34c0a082c9b7ee6a621 /net/econet | |
parent | 96159f25112595386c56e09eca90284e85e7ecbf (diff) | |
download | op-kernel-dev-8b0f9e8f78bd0a65fa001bf18f2c47eef2893a10.zip op-kernel-dev-8b0f9e8f78bd0a65fa001bf18f2c47eef2893a10.tar.gz |
ext4: avoid unnecessary spinlock in critical POSIX ACL path
If a filesystem supports POSIX ACL's, the VFS layer expects the filesystem
to do POSIX ACL checks on any files not owned by the caller, and it does
this for every single pathname component that it looks up.
That obviously can be pretty expensive if the filesystem isn't careful
about it, especially with locking. That's doubly sad, since the common
case tends to be that there are no ACL's associated with the files in
question.
ext4 already caches the ACL data so that it doesn't have to look it up
over and over again, but it does so by taking the inode->i_lock spinlock
on every lookup. Which is a noticeable overhead even if it's a private
lock, especially on CPU's where the serialization is expensive (eg Intel
Netburst aka 'P4').
For the special case of not actually having any ACL's, all that locking is
unnecessary. Even if somebody else were to be changing the ACL's on
another CPU, we simply don't care - if we've seen a NULL ACL, we might as
well use it.
So just load the ACL speculatively without any locking, and if it was
NULL, just use it. If it's non-NULL (either because we had a cached
entry, or because the cache hasn't been filled in at all), it means that
we'll need to get the lock and re-load it properly.
(This commit was ported from a patch originally authored by Linus for
ext3.)
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Diffstat (limited to 'net/econet')
0 files changed, 0 insertions, 0 deletions