lkml.org 
[lkml]   [2016]   [Dec]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH 2/2] mm: add PageWaiters indicating tasks are waiting for a page bit
On Tue, Dec 27, 2016 at 10:58 AM, Linus Torvalds
<torvalds@linux-foundation.org> wrote:
>
> The other alternative is to keep the lock bit as bit #0, and just make
> the contention bit be the high bit. Then, on x86, you can do
>
> lock andb $0xfe,flags
> js contention
>
> which might be even better. Again, it would be a very special
> operation just for unlock. Something like
>
> bit_clear_and_branch_if_negative_byte(mem, label);
>
> and again, it would be trivial to do on most architectures.
>
> Let me try to write a patch or two for testing.

Ok, that was easy.

Of course, none of this is *tested*, but it looks superficially
correct, and allows other architectures to do the same optimization if
they want.

On x86, the unlock_page() code now generates

lock; andb $1,(%rdi) #, MEM[(volatile long int *)_7]
js .L114 #,
popq %rbp #
ret

for the actual unlock itself.

Now to actually compile the whole thing and see if it boots..

Linus

\
 
 \ /
  Last update: 2016-12-27 20:30    [W:0.118 / U:0.768 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site