mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* Can someone explain under what condition inode cache pages can be swapped out?
@ 2006-08-03  6:15 Xin Zhao
  2006-08-03  7:55 ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Zhao @ 2006-08-03  6:15 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-fsdevel

Specifically, how a swaping system determine which page should be
swapped out when memory is tight? Intuitively, I think inode cache
pages should be swapped out as late as possible. But how Linux mkae
decision on this? Why linux does not pin inode pages in the memory?

Thanks in advance for kind help!

xin

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can someone explain under what condition inode cache pages can be swapped out?
  2006-08-03  6:15 Can someone explain under what condition inode cache pages can be swapped out? Xin Zhao
@ 2006-08-03  7:55 ` Jan Engelhardt
  2006-08-03 15:32   ` Xin Zhao
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2006-08-03  7:55 UTC (permalink / raw)
  To: Xin Zhao; +Cc: linux-kernel, linux-fsdevel



>
> Specifically, how a swaping system determine which page should be
> swapped out when memory is tight?

LRU, f.ex.

> Intuitively, I think inode cache
> pages should be swapped out as late as possible.

I believe they are not swapped at all - they are shrunk when memory becomes 
a premium. (If this was a math class I'd say the cache size will be zero, 
although that's not too realistic in practice)

> But how Linux mkae
> decision on this? Why linux does not pin inode pages in the memory?

Ugh hell no. Then you could trigger OOM by simply walking a big filesystem. 


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can someone explain under what condition inode cache pages can be swapped out?
  2006-08-03  7:55 ` Jan Engelhardt
@ 2006-08-03 15:32   ` Xin Zhao
  2006-08-04  5:58     ` Jan Engelhardt
  0 siblings, 1 reply; 5+ messages in thread
From: Xin Zhao @ 2006-08-03 15:32 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel, linux-fsdevel

Many thanks for kind replies.

You said inode cache is never swapped at all. In other words, the
inode cache pages are not swappable. How do you know the pages are
never swapped out? How can I tell whether a specific memory page is
swappable?  Can you point me to the right place in the kernel so that
I can see more details?

If my understanding is right, inode cache shrinker only frees the
reclaimable inodes, which means, if a lot of files are opened when
shrinker is activated, the shrinker may not find sufficient
reclaimable inodes to free enough space. What will Linux do under such
condition?

Xin

On 8/3/06, Jan Engelhardt <jengelh@linux01.gwdg.de> wrote:
>
>
> >
> > Specifically, how a swaping system determine which page should be
> > swapped out when memory is tight?
>
> LRU, f.ex.
>
> > Intuitively, I think inode cache
> > pages should be swapped out as late as possible.
>
> I believe they are not swapped at all - they are shrunk when memory becomes
> a premium. (If this was a math class I'd say the cache size will be zero,
> although that's not too realistic in practice)
>
> > But how Linux mkae
> > decision on this? Why linux does not pin inode pages in the memory?
>
> Ugh hell no. Then you could trigger OOM by simply walking a big filesystem.
>
>
> Jan Engelhardt
> --
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can someone explain under what condition inode cache pages can be swapped out?
  2006-08-03 15:32   ` Xin Zhao
@ 2006-08-04  5:58     ` Jan Engelhardt
  2006-08-04 14:44       ` Al Boldi
  0 siblings, 1 reply; 5+ messages in thread
From: Jan Engelhardt @ 2006-08-04  5:58 UTC (permalink / raw)
  To: Xin Zhao; +Cc: linux-kernel, linux-fsdevel

>
> Many thanks for kind replies.
>
> You said inode cache is never swapped at all.

Yes.

> How do you know the pages are never swapped out?

Because
- they are in kernel memory
- if someone needs memory, we free some cache

> How can I tell whether a specific memory page is
> swappable?

Kernel memory is in general not swappable.

> If my understanding is right, inode cache shrinker only frees the
> reclaimable inodes, which means, if a lot of files are opened when
> shrinker is activated, the shrinker may not find sufficient
> reclaimable inodes to free enough space. What will Linux do under such
> condition?

Userspace will start to be swapped out to make room for kernel memory.
And if the swap is full, the OOM killer comes into action and will kill 
programs.
That's why it is so important to make sure that there are no memory leaks 
in kernelspace.


Jan Engelhardt
-- 

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Can someone explain under what condition inode cache pages can be swapped out?
  2006-08-04  5:58     ` Jan Engelhardt
@ 2006-08-04 14:44       ` Al Boldi
  0 siblings, 0 replies; 5+ messages in thread
From: Al Boldi @ 2006-08-04 14:44 UTC (permalink / raw)
  To: Jan Engelhardt; +Cc: linux-kernel, linux-fsdevel, Xin Zhao

Jan Engelhardt wrote:
> > If my understanding is right, inode cache shrinker only frees the
> > reclaimable inodes, which means, if a lot of files are opened when
> > shrinker is activated, the shrinker may not find sufficient
> > reclaimable inodes to free enough space. What will Linux do under such
> > condition?
>
> Userspace will start to be swapped out to make room for kernel memory.
> And if the swap is full, the OOM killer comes into action and will kill
> programs.

The OOM-killing spree starts way before swap is full :(
see "swapping and oom-killer: gfp_mask=0x201d2, order=0" thread.


Thanks!

--
Al


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-08-04 14:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-08-03  6:15 Can someone explain under what condition inode cache pages can be swapped out? Xin Zhao
2006-08-03  7:55 ` Jan Engelhardt
2006-08-03 15:32   ` Xin Zhao
2006-08-04  5:58     ` Jan Engelhardt
2006-08-04 14:44       ` Al Boldi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®