Re: [patch 2] mm: speculative get_page

From: Nick Piggin
Date: Mon Jun 27 2005 - 19:58:53 EST


Nick Piggin wrote:
William Lee Irwin III wrote:

On Mon, Jun 27, 2005 at 04:32:38PM +1000, Nick Piggin wrote:

+static inline struct page *page_cache_get_speculative(struct page **pagep)
+{
+ struct page *page;
+
+ preempt_disable();
+ page = *pagep;
+ if (!page)
+ goto out_failed;
+
+ if (unlikely(get_page_testone(page))) {
+ /* Picked up a freed page */
+ __put_page(page);
+ goto out_failed;
+ }



So you pick up 0->1 refcount transitions.


Yep ie. a page that's freed or being freed.


Oh, one thing it does need is a check for PageFree(), so it also
picks up 1->2 and other transitions without freeing the free page
if the put()s are done out of order. Maybe that's what you were
alluding to.

I'll add that.

--
SUSE Labs, Novell Inc.

Send instant messages to your online friends http://au.messenger.yahoo.com -
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/