On Sat, Apr 27, 2013 at 03:19:01AM +0400, Glauber Costa wrote: > From: Dave Chinner <dchinner@xxxxxxxxxx> > > One of the big problems with modifying the way the dcache shrinker > and LRU implementation works is that the LRU is abused in several > ways. One of these is shrink_dentry_list(). > > Basically, we can move a dentry off the LRU onto a different list > without doing any accounting changes, and then use dentry_lru_prune() > to remove it from what-ever list it is now on to do the LRU > accounting at that point. > > This makes it -really hard- to change the LRU implementation. The > use of the per-sb LRU lock serialises movement of the dentries > between the different lists and the removal of them, and this is the > only reason that it works. If we want to break up the dentry LRU > lock and lists into, say, per-node lists, we remove the only > serialisation that allows this lru list/dispose list abuse to work. > > To make this work effectively, the dispose list has to be isolated > from the LRU list - dentries have to be removed from the LRU > *before* being placed on the dispose list. This means that the LRU > accounting and isolation is completed before disposal is started, > and that means we can change the LRU implementation freely in > future. > > This means that dentries *must* be marked with DCACHE_SHRINK_LIST > when they are placed on the dispose list so that we don't think that > parent dentries found in try_prune_one_dentry() are on the LRU when > the are actually on the dispose list. This would result in > accounting the dentry to the LRU a second time. Hence > dentry_lru_prune() has to handle the DCACHE_SHRINK_LIST case > differently because the dentry isn't on the LRU list. > > [ v2: don't decrement nr unused twice, spotted by Sha Zhengju ] > Signed-off-by: Dave Chinner <dchinner@xxxxxxxxxx> > Signed-off-by: Glauber Costa <glommer@xxxxxxxxxx> Acked-by: Mel Gorman <mgorman@xxxxxxx> -- Mel Gorman SUSE Labs -- To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to majordomo@xxxxxxxxx. For more info on Linux MM, see: http://www.linux-mm.org/ . Don't email: <a href=mailto:"dont@xxxxxxxxx"> email@xxxxxxxxx </a>