* It's time to hack on dentry_stat?
@ 2008-05-07 14:26 rae l
2008-05-07 14:51 ` Matthew Wilcox
0 siblings, 1 reply; 7+ messages in thread
From: rae l @ 2008-05-07 14:26 UTC (permalink / raw)
To: linux-fsdevel; +Cc: linux-kernel
I have noticed that struct dentry_stat_t dentry_stat is a struct with
six fields,
but only 2 of them are used, other 4 have never been used since v2.6.11,
from include/linux/dcache.h:
struct dentry_stat_t {
int nr_dentry;
int nr_unused;
int age_limit; /* age in seconds */
int want_pages; /* pages requested by system */
int dummy[2];
};
extern struct dentry_stat_t dentry_stat;
(I don't know things before v2.6.11, my local linux-2.6.git repository
can only grep to v2.6.11)
$ PAGER= git grep -w -e dentry_stat
Documentation/sysctl/fs.txt:} dentry_stat = {0, 0, 45, 0,};
fs/dcache.c:struct dentry_stat_t dentry_stat = {
fs/dcache.c: * no dcache_lock, please. The caller must decrement
dentry_stat.nr_dentry
fs/dcache.c: dentry_stat.nr_unused--;
fs/dcache.c: dentry_stat.nr_dentry--; /* For d_free, below */
fs/dcache.c: dentry_stat.nr_unused++;
fs/dcache.c: dentry_stat.nr_unused--;
fs/dcache.c: dentry_stat.nr_unused++;
fs/dcache.c: dentry_stat.nr_unused++;
fs/dcache.c: dentry_stat.nr_unused--;
fs/dcache.c: dentry_stat.nr_dentry -= detached;
fs/dcache.c: dentry_stat.nr_unused++;
fs/dcache.c: return (dentry_stat.nr_unused / 100) *
sysctl_vfs_cache_pressure;
fs/dcache.c: dentry_stat.nr_dentry++;
include/linux/dcache.h:extern struct dentry_stat_t dentry_stat;
kernel/sysctl.c: .data = &dentry_stat,
it's the same as that of v2.6.11:
$ PAGER= git grep -w -e dentry_stat v2.6.11 --
v2.6.11:Documentation/sysctl/fs.txt:} dentry_stat = {0, 0, 45, 0,};
v2.6.11:fs/dcache.c:struct dentry_stat_t dentry_stat = {
v2.6.11:fs/dcache.c: * no dcache_lock, please. The caller must
decrement dentry_stat.nr_dentry
v2.6.11:fs/dcache.c: dentry_stat.nr_unused++;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_dentry--; /* For
d_free, below */
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_dentry--; /* For d_free, below */
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused++;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused++;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused--;
v2.6.11:fs/dcache.c: dentry_stat.nr_unused++;
v2.6.11:fs/dcache.c: return (dentry_stat.nr_unused / 100) *
sysctl_vfs_cache_pressure;
v2.6.11:fs/dcache.c: dentry_stat.nr_dentry++;
v2.6.11:include/linux/dcache.h:extern struct dentry_stat_t dentry_stat;
v2.6.11:kernel/sysctl.c: .data = &dentry_stat,
So I think that struct is outdated and can be simplified.
--
Cheng
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 14:26 It's time to hack on dentry_stat? rae l
@ 2008-05-07 14:51 ` Matthew Wilcox
2008-05-07 15:06 ` rae l
2008-05-07 15:08 ` Ray Lee
0 siblings, 2 replies; 7+ messages in thread
From: Matthew Wilcox @ 2008-05-07 14:51 UTC (permalink / raw)
To: rae l; +Cc: linux-fsdevel, linux-kernel
On Wed, May 07, 2008 at 10:26:58PM +0800, rae l wrote:
> I have noticed that struct dentry_stat_t dentry_stat is a struct with
> six fields,
> but only 2 of them are used, other 4 have never been used since v2.6.11,
>
> from include/linux/dcache.h:
>
> struct dentry_stat_t {
> int nr_dentry;
> int nr_unused;
> int age_limit; /* age in seconds */
> int want_pages; /* pages requested by system */
> int dummy[2];
> };
You have to not break:
$ cat /proc/sys/fs/dentry-state
122104 115846 45 0 0 0
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 14:51 ` Matthew Wilcox
@ 2008-05-07 15:06 ` rae l
2008-05-07 15:08 ` Ray Lee
1 sibling, 0 replies; 7+ messages in thread
From: rae l @ 2008-05-07 15:06 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: linux-fsdevel, linux-kernel
On Wed, May 7, 2008 at 10:51 PM, Matthew Wilcox <matthew@wil.cx> wrote:
> You have to not break:
>
> $ cat /proc/sys/fs/dentry-state
> 122104 115846 45 0 0 0
But why? for some applicatioins?
The struct dentry_stat can be modified to have only two useful fields,
and let the other four printed with 0,
I have greped age_limit, that's also not used anymore, why we should
let it keep 45? Or Is there some historical reason?
Or just consider /proc/sys/fs/dentry-state as a binary application interface?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 14:51 ` Matthew Wilcox
2008-05-07 15:06 ` rae l
@ 2008-05-07 15:08 ` Ray Lee
2008-05-07 15:25 ` Matthew Wilcox
1 sibling, 1 reply; 7+ messages in thread
From: Ray Lee @ 2008-05-07 15:08 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: rae l, linux-fsdevel, linux-kernel
On Wed, May 7, 2008 at 7:51 AM, Matthew Wilcox <matthew@wil.cx> wrote:
> On Wed, May 07, 2008 at 10:26:58PM +0800, rae l wrote:
> > I have noticed that struct dentry_stat_t dentry_stat is a struct with
> > six fields,
> > but only 2 of them are used, other 4 have never been used since v2.6.11,
> >
> > from include/linux/dcache.h:
> >
> > struct dentry_stat_t {
> > int nr_dentry;
> > int nr_unused;
> > int age_limit; /* age in seconds */
> > int want_pages; /* pages requested by system */
> > int dummy[2];
> > };
>
> You have to not break:
>
> $ cat /proc/sys/fs/dentry-state
> 122104 115846 45 0 0 0
One could hardcode the output of the last three (four?) fields, yes?
Slightly grotty, but if it comes with a decent memory savings...
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 15:08 ` Ray Lee
@ 2008-05-07 15:25 ` Matthew Wilcox
2008-05-07 16:10 ` Ray Lee
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2008-05-07 15:25 UTC (permalink / raw)
To: Ray Lee; +Cc: rae l, linux-fsdevel, linux-kernel
On Wed, May 07, 2008 at 08:08:09AM -0700, Ray Lee wrote:
> One could hardcode the output of the last three (four?) fields, yes?
> Slightly grotty, but if it comes with a decent memory savings...
How can it be a 'decent memory saving'? There is exactly _one_ struct
dentry_stat_t in the entire kernel. So you're talking about saving 4
ints, or 16 bytes. Bet you it'd be more bytes to hardcode printing zero.
--
Intel are signing my paycheques ... these opinions are still mine
"Bill, look, we understand that you're interested in selling us this
operating system, but compare it to ours. We can't possibly take such
a retrograde step."
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 15:25 ` Matthew Wilcox
@ 2008-05-07 16:10 ` Ray Lee
2008-05-07 16:32 ` rae l
0 siblings, 1 reply; 7+ messages in thread
From: Ray Lee @ 2008-05-07 16:10 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: rae l, linux-fsdevel, linux-kernel
On Wed, May 7, 2008 at 8:25 AM, Matthew Wilcox <matthew@wil.cx> wrote:
> On Wed, May 07, 2008 at 08:08:09AM -0700, Ray Lee wrote:
> > One could hardcode the output of the last three (four?) fields, yes?
> > Slightly grotty, but if it comes with a decent memory savings...
>
> How can it be a 'decent memory saving'? There is exactly _one_ struct
> dentry_stat_t in the entire kernel. So you're talking about saving 4
> ints, or 16 bytes. Bet you it'd be more bytes to hardcode printing zero.
<shrug> Well, if there's one, then obviously there isn't. I'd assumed
it was a per-dentry overhead.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: It's time to hack on dentry_stat?
2008-05-07 16:10 ` Ray Lee
@ 2008-05-07 16:32 ` rae l
0 siblings, 0 replies; 7+ messages in thread
From: rae l @ 2008-05-07 16:32 UTC (permalink / raw)
To: Ray Lee; +Cc: Matthew Wilcox, linux-fsdevel, linux-kernel
On Thu, May 8, 2008 at 12:10 AM, Ray Lee <ray-lk@madrabbit.org> wrote:
> <shrug> Well, if there's one, then obviously there isn't. I'd assumed
> it was a per-dentry overhead.
Good. If the binary application interface must be kept,
> $ cat /proc/sys/fs/dentry-state
> 122104 115846 45 0 0 0
and to shrink dentry_stat can only save 16 bytes, there's no need to do this,
but the Documentation/ as this should be fixed?
Documentation/filesystems/proc.txt:
dentry-state
------------
Status of the directory cache. Since directory entries are dynamically
allocated and deallocated, this file indicates the current status. It holds
six values, in which the last two are not used and are always zero. The others
are listed in table 2-1.
Table 2-1: Status files of the directory cache
..............................................................................
File Content
nr_dentry Almost always zero
nr_unused Number of unused cache entries
age_limit
in seconds after the entry may be reclaimed, when memory is short
want_pages internally
..............................................................................
the age_limit and want_pages should be marked outdated and not used anymore,
But there's still one question:
1. Is age_limit always 45? Or the binary application interface would
expect it always 45?
Can we change dentry_stat with 6 int values all initialized with
zero? Then the docs can be
fixed with last four values not used and are always zero.
--
Cheng
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2008-05-07 16:32 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-07 14:26 It's time to hack on dentry_stat? rae l
2008-05-07 14:51 ` Matthew Wilcox
2008-05-07 15:06 ` rae l
2008-05-07 15:08 ` Ray Lee
2008-05-07 15:25 ` Matthew Wilcox
2008-05-07 16:10 ` Ray Lee
2008-05-07 16:32 ` rae l
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).