Re: [RFC] Peeling off dcache_lock

Rusty Russell (rusty@rustcorp.com.au)
Tue, 29 Jan 2002 11:33:19 +1100


On Fri, 25 Jan 2002 15:00:00 +0530
Dipankar Sarma <dipankar@in.ibm.com> wrote:

> Since there has been speculation about the throughput #s for lower end,
> I have put up the comparison graph in the same page
> (http://lse.sf.net/locking/dcache/dcache_lock.html).

Have you thought about getting rid of the lru list altogether, and
traverse one chain at a time in prune_dcache, using the referenced bit as
a straight clock algorithm:

spin_lock(&dentry->d_lock);
if (atomic_read(dentry->dcount) == 0) {
if (dentry->d_vfs_flags & DCACHE_REFERENCED)
dentry->d_vfs_flags &= ~DCACHE_REFERENCED;
else
prune_one_dentry(dentry);
}
spin_unlock(&dentry->d_lock);

This can be optimized by doing a dcount check outside the loop, and the
global dcache lock can be dropped between each hash chain, and we can
store the last traversed hash chain in a static var, protected by the
global lock.

I'm just not sure how much the "semi" LRU wins us...
Rusty.

-- 
  Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/