diff mbox series

[34/75] mm/vmscan: Turn page_check_dirty_writeback() into folio_check_dirty_writeback()

Message ID 20220204195852.1751729-35-willy@infradead.org (mailing list archive)
State New
Headers show
Series MM folio patches for 5.18 | expand

Commit Message

Matthew Wilcox Feb. 4, 2022, 7:58 p.m. UTC
Saves a few calls to compound_head().

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
---
 mm/vmscan.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Comments

Christoph Hellwig Feb. 7, 2022, 7:51 a.m. UTC | #1
> -	mapping = page_mapping(page);
> +	mapping = folio_mapping(folio);
>  	if (mapping && mapping->a_ops->is_dirty_writeback)
> -		mapping->a_ops->is_dirty_writeback(page, dirty, writeback);
> +		mapping->a_ops->is_dirty_writeback(&folio->page, dirty, writeback);

This adds an overly long line.

Otherwise looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>
Matthew Wilcox Feb. 12, 2022, 1:49 a.m. UTC | #2
On Sun, Feb 06, 2022 at 11:51:54PM -0800, Christoph Hellwig wrote:
> > -	mapping = page_mapping(page);
> > +	mapping = folio_mapping(folio);
> >  	if (mapping && mapping->a_ops->is_dirty_writeback)
> > -		mapping->a_ops->is_dirty_writeback(page, dirty, writeback);
> > +		mapping->a_ops->is_dirty_writeback(&folio->page, dirty, writeback);
> 
> This adds an overly long line.

Yeah, I'm planning on taking care of it in 5.19 by switching
is_dirty_writeback() to take a folio.

> Otherwise looks good:
> 
> Reviewed-by: Christoph Hellwig <hch@lst.de>
>
diff mbox series

Patch

diff --git a/mm/vmscan.c b/mm/vmscan.c
index 15cbfae0d8ec..e8c5855bc38d 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -1430,7 +1430,7 @@  static enum page_references page_check_references(struct page *page,
 }
 
 /* Check if a page is dirty or under writeback */
-static void page_check_dirty_writeback(struct page *page,
+static void folio_check_dirty_writeback(struct folio *folio,
 				       bool *dirty, bool *writeback)
 {
 	struct address_space *mapping;
@@ -1439,24 +1439,24 @@  static void page_check_dirty_writeback(struct page *page,
 	 * Anonymous pages are not handled by flushers and must be written
 	 * from reclaim context. Do not stall reclaim based on them
 	 */
-	if (!page_is_file_lru(page) ||
-	    (PageAnon(page) && !PageSwapBacked(page))) {
+	if (!folio_is_file_lru(folio) ||
+	    (folio_test_anon(folio) && !folio_test_swapbacked(folio))) {
 		*dirty = false;
 		*writeback = false;
 		return;
 	}
 
-	/* By default assume that the page flags are accurate */
-	*dirty = PageDirty(page);
-	*writeback = PageWriteback(page);
+	/* By default assume that the folio flags are accurate */
+	*dirty = folio_test_dirty(folio);
+	*writeback = folio_test_writeback(folio);
 
 	/* Verify dirty/writeback state if the filesystem supports it */
-	if (!page_has_private(page))
+	if (!folio_test_private(folio))
 		return;
 
-	mapping = page_mapping(page);
+	mapping = folio_mapping(folio);
 	if (mapping && mapping->a_ops->is_dirty_writeback)
-		mapping->a_ops->is_dirty_writeback(page, dirty, writeback);
+		mapping->a_ops->is_dirty_writeback(&folio->page, dirty, writeback);
 }
 
 static struct page *alloc_demote_page(struct page *page, unsigned long node)
@@ -1565,7 +1565,7 @@  static unsigned int shrink_page_list(struct list_head *page_list,
 		 * reclaim_congested. kswapd will stall and start writing
 		 * pages if the tail of the LRU is all dirty unqueued pages.
 		 */
-		page_check_dirty_writeback(page, &dirty, &writeback);
+		folio_check_dirty_writeback(folio, &dirty, &writeback);
 		if (dirty || writeback)
 			stat->nr_dirty++;