[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20191204152847.GZ2844@hirez.programming.kicks-ass.net>
Date: Wed, 4 Dec 2019 16:28:47 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Fenghua Yu <fenghua.yu@...el.com>
Cc: Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
H Peter Anvin <hpa@...or.com>,
Andy Lutomirski <luto@...nel.org>,
David Laight <David.Laight@...LAB.COM>,
Ashok Raj <ashok.raj@...el.com>,
Tony Luck <tony.luck@...el.com>,
Ravi V Shankar <ravi.v.shankar@...el.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
x86 <x86@...nel.org>, richard@....at
Subject: Re: [PATCH v2 3/4] mtd: rawnand: fsmc: Change to non-atomic bit
operations
On Mon, Nov 25, 2019 at 11:43:03AM -0800, Fenghua Yu wrote:
> No need for expensive atomic change_bit() on the local variable err_idx[].
>
> Signed-off-by: Fenghua Yu <fenghua.yu@...el.com>
> ---
> drivers/mtd/nand/raw/fsmc_nand.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/fsmc_nand.c b/drivers/mtd/nand/raw/fsmc_nand.c
> index a6964feeec77..916496d4ecf2 100644
> --- a/drivers/mtd/nand/raw/fsmc_nand.c
> +++ b/drivers/mtd/nand/raw/fsmc_nand.c
> @@ -809,8 +809,8 @@ static int fsmc_bch8_correct_data(struct nand_chip *chip, u8 *dat,
>
> i = 0;
> while (num_err--) {
> - change_bit(0, (unsigned long *)&err_idx[i]);
> - change_bit(1, (unsigned long *)&err_idx[i]);
> + __change_bit(0, (unsigned long *)&err_idx[i]);
> + __change_bit(1, (unsigned long *)&err_idx[i]);
>
> if (err_idx[i] < chip->ecc.size * 8) {
> change_bit(err_idx[i], (unsigned long *)dat);
I'm thinking this all can be written like:
err_idx[i] ^= 3;
if (err_idx[i] < chip->ecc.size * 8) {
err = err_idx[i];
dat[err >> 3] ^= BIT(err & 7);
}
It seems unlikely that the @dat we're correcting has concurrency issues.
Powered by blists - more mailing lists