Re: Pages swapped out even when free memory available...

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Jan Hudec wrote:
> 
> On Thu, Aug 15, 2002 at 01:02:29AM -0700, Seth Arnold wrote:
> > > Is it possible to tell the kernel the maximum amount of disk cache it should use?
> >
> > Not that I know of. This is a frequently-requested tweakable parameter,
> > and while an ideal virtual memory system would never need to be tweaked
> > by end users/administrators, I am a little surprised it isn't
> > implemented, since I think few would claim the linux virtual memory
> > system can't be improved further. :) (And no, Rik, I'm not volunteering
> > to implement it myself. rmap meets my needs fine. :)
> 
> It's simply because there is no such parameter. AFAIK the page cache
> manager does not make a difference between mapped and non-mapped pages.
> It simply has to pointers that walk the pages around with the same
> speed. The first one clears the accessed flag. The second one releases
> the page if it finds the access flag is still down. It does not look in
> memory maps and there is no flag on the page to tell it's mapped or not.

The reference count in the page struct tells you whether the page is
mapped. Clearly you must not release a page that is mapped. Kswapd walks
page tables umapping ptes (and reducing the refcount on the underlying
pages); page_launder et al walk the LRU lists (essentially, the
mem_map) looking for pages to deactivate. A page only gets on the
"inactive" LRU lists if it is not mapped; from the inactive
lists it may be discarded, or reactivated (and mapped again) to
service a page fault. The kernel definitely knows the mapping
status of all physical pages.

But this really doesn't have much to do with limiting page cache
usage...

Cheers,

-- Joe
  "I'd rather chew my leg off than maintain Java code, which
   sucks, 'cause I have a lot of Java code to maintain and
   the leg surgery is starting to get expensive." - Me
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux