Skip to content

Commit

Permalink
mm/page_io: convert count_swpout_vm_event() to take in a folio
Browse files Browse the repository at this point in the history
Convert count_swpout_vm_event() to take in a folio. We can remove five
implicit calls to compound_head() by taking in a folio.

Link: https://lkml.kernel.org/r/20230721034451.16412-10-zhangpeng362@huawei.com
Signed-off-by: ZhangPeng <zhangpeng362@huawei.com>
Cc: Christoph Hellwig <hch@infradead.org>
Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Nanyong Sun <sunnanyong@huawei.com>
Cc: Sidhartha Kumar <sidhartha.kumar@oracle.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
  • Loading branch information
ZhangPeng authored and Andrew Morton committed Aug 18, 2023
1 parent 2675251 commit 9b72b13
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions mm/page_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
return 0;
}

static inline void count_swpout_vm_event(struct page *page)
static inline void count_swpout_vm_event(struct folio *folio)
{
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
if (unlikely(PageTransHuge(page)))
if (unlikely(folio_test_pmd_mappable(folio)))
count_vm_event(THP_SWPOUT);
#endif
count_vm_events(PSWPOUT, thp_nr_pages(page));
count_vm_events(PSWPOUT, folio_nr_pages(folio));
}

#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
Expand Down Expand Up @@ -280,7 +280,7 @@ static void sio_write_complete(struct kiocb *iocb, long ret)
}
} else {
for (p = 0; p < sio->pages; p++)
count_swpout_vm_event(sio->bvec[p].bv_page);
count_swpout_vm_event(page_folio(sio->bvec[p].bv_page));
}

for (p = 0; p < sio->pages; p++)
Expand Down Expand Up @@ -339,7 +339,7 @@ static void swap_writepage_bdev_sync(struct page *page,
__bio_add_page(&bio, page, thp_size(page), 0);

bio_associate_blkg_from_page(&bio, page);
count_swpout_vm_event(page);
count_swpout_vm_event(folio);

folio_start_writeback(folio);
folio_unlock(folio);
Expand All @@ -362,7 +362,7 @@ static void swap_writepage_bdev_async(struct page *page,
__bio_add_page(bio, page, thp_size(page), 0);

bio_associate_blkg_from_page(bio, page);
count_swpout_vm_event(page);
count_swpout_vm_event(folio);
folio_start_writeback(folio);
folio_unlock(folio);
submit_bio(bio);
Expand Down

0 comments on commit 9b72b13

Please sign in to comment.