Re: [patch 2/4] mm: PageLRU no testset

From: Nikita Danilov
Date: Thu Jan 19 2006 - 12:52:37 EST


Nick Piggin writes:
> PG_lru is protected by zone->lru_lock. It does not need TestSet/TestClear
> operations.
>
> Signed-off-by: Nick Piggin <npiggin@xxxxxxx>
>
> Index: linux-2.6/mm/vmscan.c
> ===================================================================
> --- linux-2.6.orig/mm/vmscan.c
> +++ linux-2.6/mm/vmscan.c
> @@ -775,9 +775,10 @@ int isolate_lru_page(struct page *page)
> if (PageLRU(page)) {
> struct zone *zone = page_zone(page);
> spin_lock_irq(&zone->lru_lock);
> - if (TestClearPageLRU(page)) {
> + if (PageLRU(page)) {
> ret = 1;
> get_page(page);
> + ClearPageLRU(page);

Why is that better? ClearPageLRU() is also "atomic" operation (in the
sense of using LOCK_PREFIX on x86), so it seems this change strictly
adds cycles to the hot-path when page is on 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/