diff mbox series

[v2,1/5] mm: Remove definition of clear_bit_unlock_is_negative_byte

Message ID 20200416154606.306-2-willy@infradead.org (mailing list archive)
State New, archived
Headers show
Series Make PageWriteback use the PageLocked optimisation | expand

Commit Message

Matthew Wilcox April 16, 2020, 3:46 p.m. UTC
From: "Matthew Wilcox (Oracle)" <willy@infradead.org>

This local definition hasn't been used since commit 84c6591103db
("locking/atomics, asm-generic/bitops/lock.h: Rewrite using
atomic_fetch_*()") which provided a default definition.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: William Kucharski <william.kucharski@oracle.com>
Cc: Will Deacon <will@kernel.org>
---
 mm/filemap.c | 23 -----------------------
 1 file changed, 23 deletions(-)

Comments

Will Deacon April 16, 2020, 5:02 p.m. UTC | #1
On Thu, Apr 16, 2020 at 08:46:02AM -0700, Matthew Wilcox wrote:
> From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> 
> This local definition hasn't been used since commit 84c6591103db
> ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using
> atomic_fetch_*()") which provided a default definition.
> 
> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
> Cc: Will Deacon <will@kernel.org>
> ---
>  mm/filemap.c | 23 -----------------------
>  1 file changed, 23 deletions(-)

Ok, for my own curiosity I tried building for Alpha because I couldn't for
the life of me figure it out, and behold:

mm/filemap.c: In function 'unlock_page':
mm/filemap.c:1271:6: error: implicit declaration of function 'clear_bit_unlock_is_negative_byte' [-Werror=implicit-function-declaration]
  if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags))
      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
make[1]: *** [scripts/Makefile.build:267: mm/filemap.o] Error 1
make[1]: *** Waiting for unfinished jobs....
make: *** [Makefile:1722: mm] Error 2
make: *** Waiting for unfinished jobs....

I had to enable CONFIG_SMP, so maybe the robot doesn't do that?

Anyway, it's somewhat reassuring that it broke, if not unfortunate at the same
time!

Will
Matthew Wilcox April 16, 2020, 5:13 p.m. UTC | #2
On Thu, Apr 16, 2020 at 06:02:24PM +0100, Will Deacon wrote:
> On Thu, Apr 16, 2020 at 08:46:02AM -0700, Matthew Wilcox wrote:
> > From: "Matthew Wilcox (Oracle)" <willy@infradead.org>
> > This local definition hasn't been used since commit 84c6591103db
> > ("locking/atomics, asm-generic/bitops/lock.h: Rewrite using
> > atomic_fetch_*()") which provided a default definition.
> 
> Ok, for my own curiosity I tried building for Alpha because I couldn't for
> the life of me figure it out, and behold:
> 
> mm/filemap.c: In function 'unlock_page':
> mm/filemap.c:1271:6: error: implicit declaration of function 'clear_bit_unlock_is_negative_byte' [-Werror=implicit-function-declaration]
>   if (clear_bit_unlock_is_negative_byte(PG_locked, &page->flags))
>       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: some warnings being treated as errors
> 
> I had to enable CONFIG_SMP, so maybe the robot doesn't do that?
> 
> Anyway, it's somewhat reassuring that it broke, if not unfortunate at the same
> time!

Thanks!  The robot says it built two alpha configs,
randconfig-a001-20200325 and defconfig.  I imagine neither has SMP set.

kbuild people, please can you add SMP and non-SMP options to the configs
you test?
diff mbox series

Patch

diff --git a/mm/filemap.c b/mm/filemap.c
index 23a051a7ef0f..e475117e89eb 100644
--- a/mm/filemap.c
+++ b/mm/filemap.c
@@ -1248,29 +1248,6 @@  void add_page_wait_queue(struct page *page, wait_queue_entry_t *waiter)
 }
 EXPORT_SYMBOL_GPL(add_page_wait_queue);
 
-#ifndef clear_bit_unlock_is_negative_byte
-
-/*
- * PG_waiters is the high bit in the same byte as PG_lock.
- *
- * On x86 (and on many other architectures), we can clear PG_lock and
- * test the sign bit at the same time. But if the architecture does
- * not support that special operation, we just do this all by hand
- * instead.
- *
- * The read of PG_waiters has to be after (or concurrently with) PG_locked
- * being cleared, but a memory barrier should be unneccssary since it is
- * in the same byte as PG_locked.
- */
-static inline bool clear_bit_unlock_is_negative_byte(long nr, volatile void *mem)
-{
-	clear_bit_unlock(nr, mem);
-	/* smp_mb__after_atomic(); */
-	return test_bit(PG_waiters, mem);
-}
-
-#endif
-
 /**
  * unlock_page - unlock a locked page
  * @page: the page