* Can prune_icache safely discard inodes which have only clean pages? (2.4.18)
@ 2002-09-13 11:49 Bill Davenport
2002-09-13 19:57 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Bill Davenport @ 2002-09-13 11:49 UTC (permalink / raw)
To: linux-kernel
I've got a system which has a fairly large amount of physical memory (2GB)
that experiences
performance problems after a large number of files have been accessed.
Looking into the slab_info I discovered that a very large number of inodes
are currently
present in the system (along with many buffer headers). Digging deeper I was
able to determine
that most of the inodes were on the inode_unused chain, but were being
skipped over during
the prunce_icache processing because they have a non-zero number of pages
(i_data.nrpages).
Looking a bit deeper I discovered that most of the inodes had only pages
that are on the
clean_pages list, with these pages also accounting for many of the buffer
heads.
The system wasn't attempting to free these pages (presumably since it still
had a fair
amount of physical memory available, so it didn't need to do this).
Is there any danger in changing prune_icache to also pick an inode for
pruning if it has
a non-zero page count where the dirty_list and locked_list are empty?
In particular, the existing code in fs/inode.c looks somewhat like:
#define CAN_UNUSE(inode) \
((((inode)->i_state | (inode)->i_data.nrpages) == 0) && \
!inode_has_buffers(inode))
void prune_icache(int goal)
{
...
while (entry != &inode_unused)
{
...
if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK))
continue;
if (!CAN_UNUSE(inode))
continue;
Remove inode from i_hash and add to freeable
}
...
dispose_list(freeable);
...
}
and I'd like to change it to:
void prune_icache(int goal)
{
...
while (entry != &inode_unused)
{
...
if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK))
continue;
if ((inode->i_state != 0) || inode_has_buffers(inode))
continue;
if (inode->i_data.nrpages != 0) {
if ((!list_empty(&inode->i_data.dirty_pages)) ||
(!list_empty(&inode->i_data.locked_pages))) {
/* skip if any dirty or locked pages */
continue;
}
}
Remove inode from i_hash and add to freeable
}
...
dispose_list(freeable);
...
}
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Can prune_icache safely discard inodes which have only clean pages? (2.4.18)
2002-09-13 11:49 Can prune_icache safely discard inodes which have only clean pages? (2.4.18) Bill Davenport
@ 2002-09-13 19:57 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2002-09-13 19:57 UTC (permalink / raw)
To: Bill Davenport; +Cc: linux-kernel
Bill Davenport wrote:
>
> I've got a system which has a fairly large amount of physical memory (2GB)
> that experiences
> performance problems after a large number of files have been accessed.
>
> ...
Your analysis is 100% correct. It's a problem.
There's a fix for this in Andrea's kernel.
> ...
>
> and I'd like to change it to:
>
> void prune_icache(int goal)
> {
> ...
> while (entry != &inode_unused)
> {
> ...
> if (inode->i_state & (I_FREEING|I_CLEAR|I_LOCK))
> continue;
> if ((inode->i_state != 0) || inode_has_buffers(inode))
> continue;
> if (inode->i_data.nrpages != 0) {
> if ((!list_empty(&inode->i_data.dirty_pages)) ||
> (!list_empty(&inode->i_data.locked_pages))) {
> /* skip if any dirty or locked pages */
> continue;
> }
> }
locked_pages tends to hold clean, unlocked pages, alas. Testing
->dirty_pages makes sense.
If there are no dirty pages then you can run invalidate_inode_pages();
chances are, that will bring ->nrpages to zero, and all is well.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2002-09-13 19:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-09-13 11:49 Can prune_icache safely discard inodes which have only clean pages? (2.4.18) Bill Davenport
2002-09-13 19:57 ` Andrew Morton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox