Re: [PATCH] Reap dead swap cache earlier v2

John Stoffel (stoffel@casc.com)
Thu, 7 Jun 2001 10:47:11 -0400


Marcelo> As suggested by Linus, I've cleaned the reapswap code to be
Marcelo> contained inside an inline function. (yes, the if statement
Marcelo> is really ugly)

Shouldn't the "swap_count(page) == 1" check be earlier in the if
statement, so we can fall through more quickly if there is no work to
be done? A small optimization, but putting the common cases first
will help.

Marcelo> +static inline int clean_dead_swap_page (struct page* page)
Marcelo> +{
Marcelo> + int ret = 0;
Marcelo> + if (!TryLockPage (page)) {
Marcelo> + if (PageSwapCache(page) && PageDirty(page) &&
Marcelo> + (page_count(page) - !!page->buffers) == 1 &&
Marcelo> + swap_count(page) == 1) {
Marcelo> + ClearPageDirty(page);
Marcelo> + ClearPageReferenced(page);
Marcelo> + page->age = 0;
Marcelo> + ret = 1;
Marcelo> + }

Thanks,
John
John Stoffel - Senior Unix Systems Administrator - Lucent Technologies
stoffel@lucent.com - http://www.lucent.com - 978-952-7548
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/