Skip to content

Commit 9b72b13

Browse files
ZhangPengakpm00
authored andcommitted
mm/page_io: convert count_swpout_vm_event() to take in a folio
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/[email protected] Signed-off-by: ZhangPeng <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Matthew Wilcox (Oracle) <[email protected]> Cc: Nanyong Sun <[email protected]> Cc: Sidhartha Kumar <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 2675251 commit 9b72b13

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

mm/page_io.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -205,13 +205,13 @@ int swap_writepage(struct page *page, struct writeback_control *wbc)
205205
return 0;
206206
}
207207

208-
static inline void count_swpout_vm_event(struct page *page)
208+
static inline void count_swpout_vm_event(struct folio *folio)
209209
{
210210
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
211-
if (unlikely(PageTransHuge(page)))
211+
if (unlikely(folio_test_pmd_mappable(folio)))
212212
count_vm_event(THP_SWPOUT);
213213
#endif
214-
count_vm_events(PSWPOUT, thp_nr_pages(page));
214+
count_vm_events(PSWPOUT, folio_nr_pages(folio));
215215
}
216216

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

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

341341
bio_associate_blkg_from_page(&bio, page);
342-
count_swpout_vm_event(page);
342+
count_swpout_vm_event(folio);
343343

344344
folio_start_writeback(folio);
345345
folio_unlock(folio);
@@ -362,7 +362,7 @@ static void swap_writepage_bdev_async(struct page *page,
362362
__bio_add_page(bio, page, thp_size(page), 0);
363363

364364
bio_associate_blkg_from_page(bio, page);
365-
count_swpout_vm_event(page);
365+
count_swpout_vm_event(folio);
366366
folio_start_writeback(folio);
367367
folio_unlock(folio);
368368
submit_bio(bio);

0 commit comments

Comments
 (0)