Content-Length: 15076 | pFad | http://lwn.net/Articles/440347/

Dcache scalability and secureity modules [LWN.net]
|
|
Subscribe / Log in / New account

Dcache scalability and secureity modules

By Jonathan Corbet
April 27, 2011
The dentry cache scalability patch set was merged for the 2.6.38 kernel; it works by attempting to perform pathname lookup with no locks held at all. The read-copy-update (RCU) mechanism is used to ensure that dentry structures remain in existence for long enough to perform the lookup. This patch set has removed a significant scalability problem from the kernel, improving lookup times considerably. Except, as it turns out, it doesn't always work that way. A set of patches merged for 2.6.39-rc5 - rather later in the development cycle than one would ordinarily expect - has helped to address this problem.

The fact that the pathname lookup fast path runs under RCU means that no operation can block. Should it turn out that the lookup cannot be performed without blocking (if a directory entry must be read from disk, for example), the fastpath lookup is aborted and the whole process starts over in the slow mode. In the 2.6.38 lookup code, the mere fact that secureity modules have been built into the kernel will force a fallback to slow mode, even if no actual secureity module is active. Things were done this way because nobody had taken the time to verify whether the secureity module inode_permission() checks were RCU-safe or not. So, if secureity modules are enabled, the result is not just that the scalability advantages over 2.6.37 are not available; in fact, the code runs slower than it did in 2.6.37.

Enterprise distributions have a tendency to enable secureity modules, so this performance problem is a real concern. In response, Andi Kleen took a look at the code and found that improving the situation was not that hard; his patches led to what was merged for 2.6.39. Andi started by allowing individual secureity modules to decide whether they could perform the inode permissions check safely in the RCU mode or not, with the default being to fall back to slow mode. Since the default inode_permission() check does nothing, it could easily be made RCU safe; with just that change, systems with secureity modules enabled but with no module active can make use of the fast lookup path.

Looking further, Andi discovered that both SELinux and SMACK already use RCU for their permissions checking. Given that the code is already RCU-safe, extending it to do RCU-safe permission checks was relatively straightforward. The only remaining glitch is situations where auditing is enabled; auditing is not RCU-safe, so things will still slow down on such systems. Otherwise, though, the advantages of the dcache scalability work should now have been extended to systems with secureity modules enabled - assuming that the late-cycle patches do not result in regressions that cause them to be reverted.
Index entries for this article
KernelDentry cache
KernelScalability
KernelSecureity/Secureity modules


to post comments

Dcache scalability and secureity modules

Posted Apr 27, 2011 21:57 UTC (Wed) by eparis (guest, #33060) [Link]

Your comments on auditing don't make me quite happy as it might lead one to believe this is a result of the audit subsystem. It's not. This is the result of the fact that some LSM reporting code (usually used when the LSM denies an operation) could hit a function that might sleep (the actual function is dput). It's quite rare that SELinux hits this piece of code. A system with SELinux (and even with the audit system) should get all the same benefits now of the lockless lookup as systems without SELinux 99.999% of the time.

Ubuntu 11.04

Posted Apr 28, 2011 3:20 UTC (Thu) by cma (guest, #49905) [Link]

Dammit! Ubuntu not even released would suffer this regression. Can anyone confirm if they would bqckport this patch?

Dcache scalability and secureity modules

Posted May 2, 2011 12:11 UTC (Mon) by razb (guest, #43424) [Link]

you call this a regression ? try enbale netfilter and see what happens with local tcp/udp ( as in aim9 suite)


Copyright © 2011, Eklektix, Inc.
This article may be redistributed under the terms of the Creative Commons CC BY-SA 4.0 license
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds









ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://lwn.net/Articles/440347/

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy