Re: [patch 2] mm: speculative get_page

Nick Piggin
2005-06-28T00:56:45Z

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