Messages in this thread Patch in this message | | | Date | Tue, 14 Sep 2004 12:19:04 +0200 | From | Ingo Molnar <> | Subject | [patch] sched, vfs: fix scheduling latencies in prune_dcache() and select_parent() |
| |
the attached patch fixes long scheduling latencies in select_parent() and prune_dcache(). The prune_dcache() lock-break is easy, but for select_parent() the only viable solution i found was to break out if there's a resched necessary - the reordering is not necessary and the dcache scanning/shrinking will later on do it anyway.
This patch has been in the -VP patchset for weeks.
Ingo
the attached patch fixes long scheduling latencies in select_parent() and prune_dcache(). The prune_dcache() lock-break is easy, but for select_parent() the only viable solution i found was to break out if there's a resched necessary - the reordering is not necessary and the dcache scanning/shrinking will later on do it anyway.
This patch has been in the -VP patchset for weeks.
Signed-off-by: Ingo Molnar <mingo@elte.hu>
--- linux/fs/dcache.c.orig +++ linux/fs/dcache.c @@ -381,6 +381,8 @@ static void prune_dcache(int count) struct dentry *dentry; struct list_head *tmp; + cond_resched_lock(&dcache_lock); + tmp = dentry_unused.prev; if (tmp == &dentry_unused) break; @@ -553,6 +555,14 @@ resume: struct dentry *dentry = list_entry(tmp, struct dentry, d_child); next = tmp->next; + /* + * select_parent() is a performance optimization, it is + * not necessary to complete it. Abort if a reschedule is + * pending: + */ + if (need_resched()) + goto out; + if (!list_empty(&dentry->d_lru)) { dentry_stat.nr_unused--; list_del_init(&dentry->d_lru); @@ -590,6 +600,7 @@ this_parent->d_parent->d_name.name, this #endif goto resume; } +out: spin_unlock(&dcache_lock); return found; }
| |