[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAHk-=wg-C5S0zx4uSyzfJDZzG3g7U9ZMkZMQbbFyCnywtKW5qA@mail.gmail.com>
Date: Wed, 20 Sep 2023 09:58:24 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Greg Ungerer <gregungerer@...tnet.com.au>
Cc: Matthew Wilcox <willy@...radead.org>, linux-kernel@...r.kernel.org,
linux-fsdevel@...r.kernel.org, linux-arch@...r.kernel.org,
Nicholas Piggin <npiggin@...il.com>
Subject: Re: [PATCH 09/17] m68k: Implement xor_unlock_is_negative_byte
On Wed, 20 Sept 2023 at 00:45, Greg Ungerer <gregungerer@...tnet.com.au> wrote:
>
> The problem with this C implementation is that need to use loal_irq_save()
> which results in some ugly header dependencies trying top include irqflags.h.
>
> This version at least compiles and run, though we can probably do better still.
I was going to say "can't you use CAS?" but apparently coldfire
doesn't have that either. What a horrible thing.
I do wonder if we should just say "let's use the top bit instead"?
The reason we used bit #7 is that
- only x86 used to do the clear_bit_unlock_is_negative_byte
- it was easy with a simple "andb".
- it was just a trivial "move two bits around".
but honestly, on x86, doing it with "andl/andq" shouldn't be any
worse, and we can still use a (sign-extended) 8-bit immediate value to
xor the low seven bits and test the high bit at the same time - so it
should be basically exactly the same code sequence.
There's a question about mixing access widths - which can be deadly to
performance on x86 - but generally this op should be the only op on
the page flags in that sequence, and doing a byte access isn't
necessarily better.
Of course, using the top bit then screws with all the
zone/node/section/lru_gen bits that we currently put in the high bits.
So it's absolutely *not* just a trivial "move this bit" operation.
It would change all the <linux/page-flags-layout.h> games we do.
That might be enough for any sane person to go "this is not worth it",
but *if* Willy goes "I like the bit twiddling games", maybe he'd be
willing to look at that.
I mean, he wrote alpha assembler for this, that certainly says
*something* about WIlly ;)
Willy?
Linus
Powered by blists - more mailing lists