diff options
author | Denis V. Lunev <den@openvz.org> | 2007-10-17 02:29:53 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-17 11:42:57 -0400 |
commit | 37c42524d6090644206ae6d310d7e830bd3ccb47 (patch) | |
tree | 53dcaad31bb6b74d1d37491b56450a675490b88b /include | |
parent | 44a2db43eb715b54618bf01520cc5d46376cdbe2 (diff) |
shrink_dcache_sb speedup
This patch makes shrink_dcache_sb consistent with dentry pruning policy.
On the first pass we iterate over dentry unused list and prepare some
dentries for removal.
However, since the existing code moves evicted dentries to the beginning of
the LRU it can happen that fresh dentries from other superblocks will be
inserted *before* our dentries.
This can result in significant slowdown of shrink_dcache_sb(). Moreover,
for virtual filesystems like unionfs which can call dput() during dentries
kill existing code results in O(n^2) complexity.
We observed 2 minutes shrink_dcache_sb() with only 35000 dentries.
To avoid this effects we propose to isolate sb dentries at the end
of LRU list.
Signed-off-by: Denis V. Lunev <den@openvz.org>
Signed-off-by: Kirill Korotaev <dev@openvz.org>
Signed-off-by: Andrey Mirkin <amirkin@openvz.org>
Cc: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/list.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/list.h b/include/linux/list.h index ad9dcb9e3375..b0cf0135fe3e 100644 --- a/include/linux/list.h +++ b/include/linux/list.h | |||
@@ -478,6 +478,18 @@ static inline void list_splice_init_rcu(struct list_head *list, | |||
478 | pos = n, n = pos->next) | 478 | pos = n, n = pos->next) |
479 | 479 | ||
480 | /** | 480 | /** |
481 | * list_for_each_prev_safe - iterate over a list backwards safe against removal | ||
482 | of list entry | ||
483 | * @pos: the &struct list_head to use as a loop cursor. | ||
484 | * @n: another &struct list_head to use as temporary storage | ||
485 | * @head: the head for your list. | ||
486 | */ | ||
487 | #define list_for_each_prev_safe(pos, n, head) \ | ||
488 | for (pos = (head)->prev, n = pos->prev; \ | ||
489 | prefetch(pos->prev), pos != (head); \ | ||
490 | pos = n, n = pos->prev) | ||
491 | |||
492 | /** | ||
481 | * list_for_each_entry - iterate over list of given type | 493 | * list_for_each_entry - iterate over list of given type |
482 | * @pos: the type * to use as a loop cursor. | 494 | * @pos: the type * to use as a loop cursor. |
483 | * @head: the head for your list. | 495 | * @head: the head for your list. |