Re: [CFT][PATCH] Re: Fwd: Re: memory usage - dentry_cache

From: Marcin Kowalski (kowalski@datrix.co.za)
Date: Thu Apr 12 2001 - 07:27:24 EST


Hi

Regarding the patch ....

I don't have experience with the linux kernel internals but could this patch
not lead to a run-loop condition as the only thing that can break our of the
for(;;) loop is the tmp==&dentry_unused statement. So if the required number
of dentries does not exist and this condition is not satisfied we would have
an infinate loop... sorry if this is a silly question.

Also the comment >/* If the dentry was recently referenced, don't free it.
*/<, the code inside is excuted if the DCACHE_REFERENCED flags are set and in
the code is is reversing the DCACHE_REFERENCED flag on the dentry and adding
it to the dentry_unsed list??? So a Refrenched entry is set Not Referenced
and place in the unsed list?? I am unclear about that... is the comment
correct or is my understanding lacking (which is very probable :-))..

TIA
MarCin

FYI >--------

 void prune_dcache(int count)
{
        spin_lock(&dcache_lock);
        for (;;) {
                struct dentry *dentry;
                struct list_head *tmp;
 
                tmp = dentry_unused.prev;
 
                if (tmp == &dentry_unused)
                        break;
                list_del_init(tmp);
                dentry = list_entry(tmp, struct dentry, d_lru);
 
                /* If the dentry was recently referenced, don't free it. */
                if (dentry->d_flags & DCACHE_REFERENCED) {
                        dentry->d_flags &= ~DCACHE_REFERENCED;
                        list_add(&dentry->d_lru, &dentry_unused);
                        continue;
                }
                dentry_stat.nr_unused--;
 
                /* Unused dentry with a count? */
                if (atomic_read(&dentry->d_count))
                        BUG();
 
                prune_one_dentry(dentry);
                if (!--count)
                        break;
        }
        spin_unlock(&dcache_lock);
}

-----------------------------
     Marcin Kowalski
     Linux/Perl Developer
     Datrix Solutions
     Cel. 082-400-7603
      ***Open Source Kicks Ass***
-----------------------------
-
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/



This archive was generated by hypermail 2b29 : Sun Apr 15 2001 - 21:00:18 EST