linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Greg Ungerer <gerg@linux-m68k.org>
To: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
	Andrew Morton <akpm@linux-foundation.org>
Cc: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org,
	linux-arch@vger.kernel.org, torvalds@linux-foundation.org,
	npiggin@gmail.com
Subject: Re: [PATCH v2 09/17] m68k: Implement xor_unlock_is_negative_byte
Date: Thu, 5 Oct 2023 09:49:15 +1000	[thread overview]
Message-ID: <89a5a892-8b34-416d-8b37-a10be3080d54@linux-m68k.org> (raw)
In-Reply-To: <20231004165317.1061855-10-willy@infradead.org>


On 5/10/23 02:53, Matthew Wilcox (Oracle) wrote:
> Using EOR to clear the guaranteed-to-be-set lock bit will test the
> negative flag just like the x86 implementation.  This should be
> more efficient than the generic implementation in filemap.c.  It
> would be better if m68k had __GCC_ASM_FLAG_OUTPUTS__.
> 
> Coldfire doesn't have a byte-sized EOR, so we test bit 7 after the
> EOR, which is a second memory access, but it's slightly better than
> the current C code.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>

Acked-by: Greg Ungerer <gerg@linux-m68k.org>


> ---
>   arch/m68k/include/asm/bitops.h | 22 ++++++++++++++++++++++
>   1 file changed, 22 insertions(+)
> 
> diff --git a/arch/m68k/include/asm/bitops.h b/arch/m68k/include/asm/bitops.h
> index e984af71df6b..80ee36095905 100644
> --- a/arch/m68k/include/asm/bitops.h
> +++ b/arch/m68k/include/asm/bitops.h
> @@ -319,6 +319,28 @@ arch___test_and_change_bit(unsigned long nr, volatile unsigned long *addr)
>   	return test_and_change_bit(nr, addr);
>   }
>   
> +static inline bool xor_unlock_is_negative_byte(unsigned long mask,
> +		volatile unsigned long *p)
> +{
> +#ifdef CONFIG_COLDFIRE
> +	__asm__ __volatile__ ("eorl %1, %0"
> +		: "+m" (*p)
> +		: "d" (mask)
> +		: "memory");
> +	return *p & (1 << 7);
> +#else
> +	char result;
> +	char *cp = (char *)p + 3;	/* m68k is big-endian */
> +
> +	__asm__ __volatile__ ("eor.b %1, %2; smi %0"
> +		: "=d" (result)
> +		: "di" (mask), "o" (*cp)
> +		: "memory");
> +	return result;
> +#endif
> +}
> +#define xor_unlock_is_negative_byte xor_unlock_is_negative_byte
> +
>   /*
>    *	The true 68020 and more advanced processors support the "bfffo"
>    *	instruction for finding bits. ColdFire and simple 68000 parts


  reply	other threads:[~2023-10-04 23:49 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-04 16:53 [PATCH v2 00/17] Add folio_end_read Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 01/17] iomap: Hold state_lock over call to ifs_set_range_uptodate() Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 02/17] iomap: Protect read_bytes_pending with the state_lock Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 03/17] mm: Add folio_end_read() Matthew Wilcox (Oracle)
2024-02-23 15:26   ` Tetsuo Handa
2024-02-23 15:36     ` Matthew Wilcox
2023-10-04 16:53 ` [PATCH v2 04/17] ext4: Use folio_end_read() Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 05/17] buffer: " Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 06/17] iomap: " Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 07/17] bitops: Add xor_unlock_is_negative_byte() Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 08/17] alpha: Implement xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 09/17] m68k: " Matthew Wilcox (Oracle)
2023-10-04 23:49   ` Greg Ungerer [this message]
2023-10-05  8:11   ` Geert Uytterhoeven
2023-10-04 16:53 ` [PATCH v2 10/17] mips: " Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 11/17] powerpc: Implement arch_xor_unlock_is_negative_byte on 32-bit Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 12/17] riscv: Implement xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 13/17] s390: Implement arch_xor_unlock_is_negative_byte Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 14/17] mm: Delete checks for xor_unlock_is_negative_byte() Matthew Wilcox (Oracle)
2023-10-05  8:12   ` Geert Uytterhoeven
2023-10-04 16:53 ` [PATCH v2 15/17] mm: Add folio_xor_flags_has_waiters() Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 16/17] mm: Make __end_folio_writeback() return void Matthew Wilcox (Oracle)
2023-10-04 16:53 ` [PATCH v2 17/17] mm: Use folio_xor_flags_has_waiters() in folio_end_writeback() Matthew Wilcox (Oracle)

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=89a5a892-8b34-416d-8b37-a10be3080d54@linux-m68k.org \
    --to=gerg@linux-m68k.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=npiggin@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox