Re: one question about LRU mechanism

From: Nikita Danilov
Date: Wed Jun 15 2005 - 06:32:27 EST


liyu@LAN writes:

[...]

>
> /************************************************************/
> while (scan++ < nr_to_scan && !list_empty(src)) {
> page = lru_to_page(src);
> prefetchw_prev_lru_page(page, src, flags);
>
> if (!TestClearPageLRU(page))
> BUG();
> list_del(&page->lru);

[...]

>
> /***************************************************/
> while (scan++ < nr_to_scan && !list_empty(src->prev)) {

list_empty(something) and list_empty(something->prev) are equivalent for
well-formed lists.

list_empty(src) check in isolate_lru_pages() is for pathological case
when active list becomes empty. Also active and inactive lists are not
LRU, they are closer to second-chance-FIFO, it is _together_ that they
emulate LRU.

Nikita.
-
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/