Skip to content

Commit 98630cf

Browse files
ZhangPengakpm00
authored andcommitted
mm/page_io: convert bio_associate_blkg_from_page() to take in a folio
Convert bio_associate_blkg_from_page() to take in a folio. We can remove two implicit calls to compound_head() by taking in a folio. Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: ZhangPeng <[email protected]> Reviewed-by: Matthew Wilcox (Oracle) <[email protected]> Cc: Christoph Hellwig <[email protected]> Cc: Kefeng Wang <[email protected]> Cc: Nanyong Sun <[email protected]> Cc: Sidhartha Kumar <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
1 parent 9b72b13 commit 98630cf

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

mm/page_io.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -215,12 +215,12 @@ static inline void count_swpout_vm_event(struct folio *folio)
215215
}
216216

217217
#if defined(CONFIG_MEMCG) && defined(CONFIG_BLK_CGROUP)
218-
static void bio_associate_blkg_from_page(struct bio *bio, struct page *page)
218+
static void bio_associate_blkg_from_page(struct bio *bio, struct folio *folio)
219219
{
220220
struct cgroup_subsys_state *css;
221221
struct mem_cgroup *memcg;
222222

223-
memcg = page_memcg(page);
223+
memcg = folio_memcg(folio);
224224
if (!memcg)
225225
return;
226226

@@ -230,7 +230,7 @@ static void bio_associate_blkg_from_page(struct bio *bio, struct page *page)
230230
rcu_read_unlock();
231231
}
232232
#else
233-
#define bio_associate_blkg_from_page(bio, page) do { } while (0)
233+
#define bio_associate_blkg_from_page(bio, folio) do { } while (0)
234234
#endif /* CONFIG_MEMCG && CONFIG_BLK_CGROUP */
235235

236236
struct swap_iocb {
@@ -338,7 +338,7 @@ static void swap_writepage_bdev_sync(struct page *page,
338338
bio.bi_iter.bi_sector = swap_page_sector(page);
339339
__bio_add_page(&bio, page, thp_size(page), 0);
340340

341-
bio_associate_blkg_from_page(&bio, page);
341+
bio_associate_blkg_from_page(&bio, folio);
342342
count_swpout_vm_event(folio);
343343

344344
folio_start_writeback(folio);
@@ -361,7 +361,7 @@ static void swap_writepage_bdev_async(struct page *page,
361361
bio->bi_end_io = end_swap_bio_write;
362362
__bio_add_page(bio, page, thp_size(page), 0);
363363

364-
bio_associate_blkg_from_page(bio, page);
364+
bio_associate_blkg_from_page(bio, folio);
365365
count_swpout_vm_event(folio);
366366
folio_start_writeback(folio);
367367
folio_unlock(folio);

0 commit comments

Comments
 (0)