lkml.org 
[lkml]   [2007]   [May]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 2.6.22 -mm merge plans -- vm bugfixes
Andrew Morton wrote:
> On Thu, 03 May 2007 11:32:23 +1000 Nick Piggin <nickpiggin@yahoo.com.au> wrote:
>
>
>> void fastcall unlock_page(struct page *page)
>> {
>>+ VM_BUG_ON(!PageLocked(page));
>> smp_mb__before_clear_bit();
>>- if (!TestClearPageLocked(page))
>>- BUG();
>>- smp_mb__after_clear_bit();
>>- wake_up_page(page, PG_locked);
>>+ ClearPageLocked(page);
>>+ if (unlikely(test_bit(PG_waiters, &page->flags))) {
>>+ clear_bit(PG_waiters, &page->flags);
>>+ wake_up_page(page, PG_locked);
>>+ }
>> }
>
>
> Why is that significantly faster than plain old wake_up_page(), which
> tests waitqueue_active()?

Because it needs fewer barriers and doesn't touch random a random hash
cacheline in the fastpath.

--
SUSE Labs, Novell Inc.
-
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: 2007-05-04 06:21    [W:0.730 / U:0.124 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site