lkml.org 
[lkml]   [2001]   [Jun]   [7]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    From
    Date
    SubjectRe: [PATCH] Reap dead swap cache earlier v2

    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/

    \
     
     \ /
      Last update: 2005-03-22 12:54    [W:0.025 / U:0.216 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site