diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-06-05 23:20:17 -0400 |
---|---|---|
committer | Matthew Wilcox (Oracle) <willy@infradead.org> | 2021-09-27 09:27:29 -0400 |
commit | c25303281d79299e9f35d4b2e496a8bd134d5715 (patch) | |
tree | b71b1e663e9bbc24346993d9b6fcf6574675680a /include/linux/page_ref.h | |
parent | 5816b3e6577eaa676ceb00a848f0fd65fe2adc29 (diff) | |
download | lwn-c25303281d79299e9f35d4b2e496a8bd134d5715.tar.gz lwn-c25303281d79299e9f35d4b2e496a8bd134d5715.zip |
mm: Convert get_page_unless_zero() to return bool
atomic_add_unless() returns bool, so remove the widening casts to int
in page_ref_add_unless() and get_page_unless_zero(). This causes gcc
to produce slightly larger code in isolate_migratepages_block(), but
it's not clear that it's worse code. Net +19 bytes of text.
Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Acked-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reviewed-by: David Howells <dhowells@redhat.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'include/linux/page_ref.h')
-rw-r--r-- | include/linux/page_ref.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/page_ref.h b/include/linux/page_ref.h index 7ad46f45df39..3a799de8ad52 100644 --- a/include/linux/page_ref.h +++ b/include/linux/page_ref.h @@ -161,9 +161,9 @@ static inline int page_ref_dec_return(struct page *page) return ret; } -static inline int page_ref_add_unless(struct page *page, int nr, int u) +static inline bool page_ref_add_unless(struct page *page, int nr, int u) { - int ret = atomic_add_unless(&page->_refcount, nr, u); + bool ret = atomic_add_unless(&page->_refcount, nr, u); if (page_ref_tracepoint_active(page_ref_mod_unless)) __page_ref_mod_unless(page, nr, ret); |