Re: Evicting Anonymous pages.

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

 



>  I am trying to understand the kernel page frame reclaiming
> mechanism, but one thing's bothering me:
> How does the kernel 'know' which anonymous pages to evict? In the LRU
> scheme,  'referenced/used' information for each page is required
> (AFAIK). But anonymous pages can be used by user processes 'at any
> time' without the kernel knowing about it.

a. Every anonymous page starts out referenced.
b. The process address space is described by the mm_struct, which has
different regions defined by vm_area_struct(vma).
c. A region may represent the process heap for use with malloc(), a
memory mapped file such as a shared library
or a block of anonymous memory allocated with mmap().
d. Every physical page(atleast those directly mapped into kernel
linear address space) have a struct page associated with it.
e. Now struct page has a struct address_space *mapping  in it. In
mapping, if low bit clear, points to inode address_space else if page
mapped as anonymous low bit is set.
f. Lets say low bit is set, then this mapping points to a anon_vma
struct. This anon_vma is linked list of all vma's that have reference
to that page. If the kernel needs to unmap a anonymous page, it must
follow this linked list and examine every VMA it finds. Once the page
is unmapped from every page table found from each
vma(vma-->mm_struct-->pgd), it can be freed.

-syed

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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