So what we want CPUB do instead is
spin_lock(lru_lock);
page = list_entry(lru)
START ATOMIC
page_cache_get(page);
res = (page_count (page) == 1)
END ATOMIC
if (res) {
atomic_dec (&page->count);
continue; /* with next page */
}
...
page_cache_release (page);
I.e. we want to detect _atomically_ that we just raised the page count
from zero to one. My patch actually has a solution that implements the
needed atomic operation above by means of the atomic functions that we
currently have on all archs (it's called get_page_testzero and
should probably called get_page_testone).
The more I think about this the more I think this is the way to go.
regards Christian
-- THAT'S ALL FOLKS! - 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/