* [patch] dentry_stat fix
@ 2003-04-14 9:14 Maneesh Soni
2003-04-14 9:14 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Maneesh Soni @ 2003-04-14 9:14 UTC (permalink / raw)
To: Andrew Morton; +Cc: Dipankar Sarma, LKML
Hello Andrew,
This patch the corrects the dentry_stat.nr_unused calculation.
In select_parent() and shrink_dcache_anon() we were not doing
any adjustments to the nr_unused count after manipulating the dentry_unused
list. Now the nr_unused count is decremented if the dentry is on dentry_unused
list and is removed from there.
Further in the same routines, we have to adjust the nr_unused count
again if the dentry is moved to the end of d_lru list for pruning.
Regards,
Maneesh
diff -urN linux-2.5.67-base/fs/dcache.c linux-2.5.67-dentry_stat/fs/dcache.c
--- linux-2.5.67-base/fs/dcache.c Mon Apr 7 23:00:42 2003
+++ linux-2.5.67-dentry_stat/fs/dcache.c Fri Apr 11 15:53:53 2003
@@ -538,13 +538,18 @@
struct list_head *tmp = next;
struct dentry *dentry = list_entry(tmp, struct dentry, d_child);
next = tmp->next;
- list_del_init(&dentry->d_lru);
- /* don't add non zero d_count dentries
- * back to d_lru list
+ if (!list_empty(&dentry->d_lru)) {
+ dentry_stat.nr_unused--;
+ list_del_init(&dentry->d_lru);
+ }
+ /*
+ * move only zero ref count dentries to the end
+ * of the unused list for prune_dcache
*/
if (!atomic_read(&dentry->d_count)) {
list_add(&dentry->d_lru, dentry_unused.prev);
+ dentry_stat.nr_unused++;
found++;
}
/*
@@ -609,13 +614,18 @@
spin_lock(&dcache_lock);
hlist_for_each(lp, head) {
struct dentry *this = hlist_entry(lp, struct dentry, d_hash);
- list_del(&this->d_lru);
+ if (!list_empty(&this->d_lru)) {
+ dentry_stat.nr_unused--;
+ list_del(&this->d_lru);
+ }
- /* don't add non zero d_count dentries
- * back to d_lru list
+ /*
+ * move only zero ref count dentries to the end
+ * of the unused list for prune_dcache
*/
if (!atomic_read(&this->d_count)) {
list_add_tail(&this->d_lru, &dentry_unused);
+ dentry_stat.nr_unused++;
found++;
}
}
--
Maneesh Soni
IBM Linux Technology Center,
IBM India Software Lab, Bangalore.
Phone: +91-80-5044999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/
--
Maneesh Soni
IBM Linux Technology Center,
IBM India Software Lab, Bangalore.
Phone: +91-80-5044999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [patch] dentry_stat fix
2003-04-14 9:14 [patch] dentry_stat fix Maneesh Soni
@ 2003-04-14 9:14 ` Andrew Morton
2003-04-14 12:39 ` Maneesh Soni
0 siblings, 1 reply; 4+ messages in thread
From: Andrew Morton @ 2003-04-14 9:14 UTC (permalink / raw)
To: maneesh; +Cc: dipankar, linux-kernel
Maneesh Soni <maneesh@in.ibm.com> wrote:
>
> This patch the corrects the dentry_stat.nr_unused calculation.
OK, I didn't even know we had a bug in there...
btw, can you explain to me why shrink_dcache_anon() and select_parent() are
putting dentries at the wrong end of dentry_unused?
Do these dentries have DCACHE_REFERENCED set?
Why shouldn't they get a full two rounds of aging?
It is not clear what's going on in there. Thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] dentry_stat fix
2003-04-14 9:14 ` Andrew Morton
@ 2003-04-14 12:39 ` Maneesh Soni
2003-04-14 19:26 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Maneesh Soni @ 2003-04-14 12:39 UTC (permalink / raw)
To: Andrew Morton; +Cc: dipankar, linux-kernel
On Mon, Apr 14, 2003 at 02:14:48AM -0700, Andrew Morton wrote:
> Maneesh Soni <maneesh@in.ibm.com> wrote:
> >
> > This patch the corrects the dentry_stat.nr_unused calculation.
>
> OK, I didn't even know we had a bug in there...
>
> btw, can you explain to me why shrink_dcache_anon() and select_parent() are
> putting dentries at the wrong end of dentry_unused?
prune_dcache() picks up from this end in first round. It will reset the
DCACHE_REFERENCED flag and will put it to the front of dentry_unused list.
>
> Do these dentries have DCACHE_REFERENCED set?
They will have DCACHE_REFERENCED set as they are on the unused list. The flag
get reset in the first round of aging.
> Why shouldn't they get a full two rounds of aging?
They do get.
> It is not clear what's going on in there. Thanks.
I am posting one more patch which makes the DCACHE_REFERENCED flag uses
proper following this one.
Maneesh
--
Maneesh Soni
IBM Linux Technology Center,
IBM India Software Lab, Bangalore.
Phone: +91-80-5044999 email: maneesh@in.ibm.com
http://lse.sourceforge.net/
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [patch] dentry_stat fix
2003-04-14 12:39 ` Maneesh Soni
@ 2003-04-14 19:26 ` Andrew Morton
0 siblings, 0 replies; 4+ messages in thread
From: Andrew Morton @ 2003-04-14 19:26 UTC (permalink / raw)
To: maneesh; +Cc: dipankar, linux-kernel
Maneesh Soni <maneesh@in.ibm.com> wrote:
>
> On Mon, Apr 14, 2003 at 02:14:48AM -0700, Andrew Morton wrote:
> > Maneesh Soni <maneesh@in.ibm.com> wrote:
> > >
> > > This patch the corrects the dentry_stat.nr_unused calculation.
> >
> > OK, I didn't even know we had a bug in there...
> >
> > btw, can you explain to me why shrink_dcache_anon() and select_parent() are
> > putting dentries at the wrong end of dentry_unused?
> prune_dcache() picks up from this end in first round. It will reset the
> DCACHE_REFERENCED flag and will put it to the front of dentry_unused list.
>
Sorry, but I still don't understand why they're being put at the "oldest" end
of dentry_unused.
Also, shrink_dcache_anon() does:
prune_dcache(found);
I hope we're not assuming that all the dentries which were just added will be
freed? They hae the referenced bit set, and new dentries can be added...
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2003-04-14 19:15 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-04-14 9:14 [patch] dentry_stat fix Maneesh Soni
2003-04-14 9:14 ` Andrew Morton
2003-04-14 12:39 ` Maneesh Soni
2003-04-14 19:26 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox