From: Matthew Wilcox <willy@infradead.org>
To: linux-mm@kvack.org, linux-fsdevel@vger.kernel.org
Cc: "Matthew Wilcox (Oracle)" <willy@infradead.org>,
Richard Henderson <rth@twiddle.net>,
Ivan Kokshaysky <ink@jurassic.park.msu.ru>,
Matt Turner <mattst88@gmail.com>,
linux-alpha@vger.kernel.org
Subject: [PATCH v3 01/11] alpha: Add clear_bit_unlock_is_negative_byte implementation
Date: Thu, 16 Apr 2020 15:01:20 -0700 [thread overview]
Message-ID: <20200416220130.13343-2-willy@infradead.org> (raw)
In-Reply-To: <20200416220130.13343-1-willy@infradead.org>
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
Copy and paste the clear_bit_unlock() implementation, and test the temp
variable to see if it has bit 7 set. Saves two instructions: a load
and a compare:
860: 01 31 20 44 andnot t0,0x1,t0
864: 00 00 30 b8 stl_c t0,0(a0)
868: 67 1b 20 e4 beq t0,7608 <generic_file_write_iter+0x218>
- 86c: 00 00 30 a0 ldl t0,0(a0)
- 870: 01 10 30 44 and t0,0x80,t0
- 874: a1 03 e1 43 cmpult zero,t0,t0
- 878: 01 00 20 f4 bne t0,880 <unlock_page+0x40>
- 87c: 01 80 fa 6b ret
+ 86c: 01 10 30 44 and t0,0x80,t0
+ 870: 03 00 20 f4 bne t0,880 <unlock_page+0x40>
+ 874: 01 80 fa 6b ret
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Richard Henderson <rth@twiddle.net>
Cc: Ivan Kokshaysky <ink@jurassic.park.msu.ru>
Cc: Matt Turner <mattst88@gmail.com>
Cc: linux-alpha@vger.kernel.org
---
arch/alpha/include/asm/bitops.h | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/arch/alpha/include/asm/bitops.h b/arch/alpha/include/asm/bitops.h
index 5adca78830b5..f9af2401bd23 100644
--- a/arch/alpha/include/asm/bitops.h
+++ b/arch/alpha/include/asm/bitops.h
@@ -79,6 +79,29 @@ clear_bit_unlock(unsigned long nr, volatile void * addr)
clear_bit(nr, addr);
}
+static inline bool clear_bit_unlock_is_negative_byte(unsigned int nr,
+ volatile unsigned long *p)
+{
+ unsigned long temp;
+ int *m = ((int *)p) + (nr >> 5);
+
+ smp_mb();
+ __asm__ __volatile__(
+ "1: ldl_l %0,%3\n"
+ " bic %0,%2,%0\n"
+ " stl_c %0,%1\n"
+ " beq %0,2f\n"
+ ".subsection 2\n"
+ "2: br 1b\n"
+ ".previous"
+ :"=&r" (temp), "=m" (*m)
+ :"Ir" (1UL << (nr & 31)), "m" (*m));
+
+ return temp & 128;
+}
+#define clear_bit_unlock_is_negative_byte \
+ clear_bit_unlock_is_negative_byte
+
/*
* WARNING: non atomic version.
*/
--
2.25.1
next prev parent reply other threads:[~2020-04-16 22:01 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-16 22:01 [PATCH v3 00/11] Make PageWriteback use the PageLocked optimisation Matthew Wilcox
2020-04-16 22:01 ` Matthew Wilcox [this message]
2020-04-16 22:01 ` [PATCH v3 02/11] ia64: Add clear_bit_unlock_is_negative_byte implementation Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 03/11] m68k: " Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 04/11] mips: " Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 05/11] riscv: " Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 06/11] s390: " Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 07/11] mm: Remove definition of clear_bit_unlock_is_negative_byte Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 08/11] mm: Move PG_writeback into the bottom byte Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 09/11] mm: Convert writeback BUG to WARN_ON Matthew Wilcox
2020-04-23 15:58 ` Jan Kara
2020-04-16 22:01 ` [PATCH v3 10/11] mm: Use clear_bit_unlock_is_negative_byte for PageWriteback Matthew Wilcox
2020-04-16 22:01 ` [PATCH v3 11/11] mm: Remove TestClearPageWriteback Matthew Wilcox
2020-04-17 7:28 ` [PATCH v3 00/11] Make PageWriteback use the PageLocked optimisation Geert Uytterhoeven
2020-04-17 11:12 ` Matthew Wilcox
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=20200416220130.13343-2-willy@infradead.org \
--to=willy@infradead.org \
--cc=ink@jurassic.park.msu.ru \
--cc=linux-alpha@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mattst88@gmail.com \
--cc=rth@twiddle.net \
/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;
as well as URLs for NNTP newsgroup(s).