Re: Reading the LRU Active and Incative List

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

 



Thankyou Mulyadi.

I know that PFNs need not be in numerical order in the active list. So let me rephrase my question. We consider five pages X1, X2, X3, X4, X5 inserted into the head of the active list in the order of page faults let's say as follows

X1 -> X3 -> X4 -> X2 -> X5.

Now when new pages are brought in and added to the head of the active list we should see X1 move down the active list gradually as follows as we read the active list at different instants of time.

X8 -> X100 -> X1 -> X3 -> X4 -> X2 -> X5.
X50 -> X35 -> X75 -> X8 -> X100 -> X1 -> X3 -> X4 -> X2 -> X5.
...

However, I see instead that X1 starts at the head, goes back to a position 10 in the list and in the next instant comes back to position 8 then goes back to position 15 etc.

Each reading is captured at the interval of 1 second. And I read the first 200 elements of the active list.

I would think, X1 should have moved behind in the active list until I see it no more (after the first 200 elements) and another page fault may bring it to the head of the active list. Instead what I see is, within a fraction of 1 second, X1 goes to position 10, comes back to position 8 and goes back to postion 15. What am I missing?

Thanks

On 10/28/06, Mulyadi Santosa <mulyadi.santosa@xxxxxxxxx> wrote:
Hi Bithika...

Replies are below... just sharing my thoughts..

> I am trying to read the LRU active list for each zone starting from
> the head of the active list. Following is a code snippet
>
> **********************************************
> show_active(&zone->active_list);
>
>
> void show_active(struct list_head *init_active_list){
> struct list_head *temp;
> struct page *p;
>
> for (temp=init_active_list->next; temp != init_active_list;
> temp=temp->next){
>   p = list_entry(temp, struct page, lru);
> }
> }
> *********************************************
>
>
>
> However, when I print page frame numbers obtained from above, I
> notice that the page frame numbers seem to move back and forth in the
> active list and doesnot seem to follow a stack order as maintained by
> the kernel when it adds new pages to the head of the active list.

IMHO that's because in reality pages get allocated (and de-allocated) in
non ordered fashion. Also, nothing prevents you to allocate non
physically contigous memory pages. And that means...well, non ordered
PFN of the pages.


>2. What is the difference between page->lru and
> zone->active_list/zone_inactive_list?

I think the name speaks for itself. "page" is the list of all pages,
while "zone" means pages that belongs on certain zone (DMA, normal,
highmem (doesn't exist in 64-bit machines)). Sorry, I can't give any
ideas about your #1 question.

Somebody CMIIW.

regards,

Mulyadi.




--
O for a Life of Sensations rather than of Thoughts!-- Keats

[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