one question about LRU mechanism

From: liyu@WAN
Date: Wed Jun 15 2005 - 00:06:30 EST


Hello everybody:

I am a linux kernel newbie.

I am reading memory managment code of kernel 2.6.11.11.
I found LRU is implement as linked-stack in linux, include two important
data structure linked-list :
zone->active_list and zone->inactive_list. when kernel need reclaim some
pages, it will call function refiil_inactive_list() ultimately to move
some page from active_list to inactive_list.

It's OK, but I have one question in my mind:
I found all function that append page to active_list, it just append
page to head of active_list (use inline function list_add() ), but
refill_inactive_list() also start scanning from head of active_list, I
think the better way scan active_list is start from rear of active_list
and scan though prev member of list_head at reclaim pages. Scanning
start from head of active_list may make thrashing more possibly, I
think. and, in my view, "head of active_list" is zone->active_list,
"rear of active_list" is zone->active_list.prev .

May be, I am failed understand mm? or what's wrong?

Thanks in advanced.

Alas, my english so bad.

liyu

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/