Skip to contentSkip to conversation

mm: Fix PSWPIN counter for large folios swap-in

PATCH Applied Barry Song 3 participants 3 messages Oct 23, 2024 – Oct 24, 2024

Subsystems (2)
lore
Share & tools
lore

Barry Song

author
#0 lore raw

PATCH 1/1 mm: Fix PSWPIN counter for large folios swap-in

From: Barry Song <[email protected]>

Similar to PSWPOUT, we should count the number of base pages instead of large folios.

Fixes 242d12c98174 ("mm: support large folios swap-in for sync io devices")
Cc Chris Li <[email protected]>
Cc Yosry Ahmed <[email protected]>
Cc Baolin Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Kairui Song <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Kanchana P Sridhar <[email protected]>
Cc Usama Arif <[email protected]>
---
 mm/page_io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_io.c +2 -2
index a28d28b6b3ce..c69fab5060a1 100644
@@ -574,7 +574,7 @@ static void swap_read_folio_bdev_sync(struct folio *folio,
 	 */
 	get_task_struct(current);
 	count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio));
-	count_vm_event(PSWPIN);
+	count_vm_events(PSWPIN, folio_nr_pages(folio));
 	submit_bio_wait(&bio);
 	__end_swap_bio_read(&bio);
 	put_task_struct(current);
@@ -590,7 +590,7 @@ static void swap_read_folio_bdev_async(struct folio *folio,
 	bio->bi_end_io = end_swap_bio_read;
 	bio_add_folio_nofail(bio, folio, folio_size(folio), 0);
 	count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio));
-	count_vm_event(PSWPIN);
+	count_vm_events(PSWPIN, folio_nr_pages(folio));
 	submit_bio(bio);
 }
 
Signature · 1 line
2.39.3 (Apple Git-146)
Acked-by on v1 1/1
#1 lore raw
Quoted 16 lines · Barry Song

From: Barry Song <[email protected]>

Similar to PSWPOUT, we should count the number of base pages instead of large folios.

Fixes 242d12c98174 ("mm: support large folios swap-in for sync io devices")
Cc Chris Li <[email protected]>
Cc Yosry Ahmed <[email protected]>
Cc Baolin Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Kairui Song <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Kanchana P Sridhar <[email protected]>
Cc Usama Arif <[email protected]>
Quoted 4 lines
---
  mm/page_io.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
Signature · 3 lines
Cheers,

David / dhildenb
Reviewed-by on v1 1/1
#2 lore raw
In reply to Barry Song
Quoted 5 lines · Barry Song

From: Barry Song <[email protected]>

Similar to PSWPOUT, we should count the number of base pages instead of large folios.

Quoted 11 lines
Fixes 242d12c98174 ("mm: support large folios swap-in for sync io devices")
Cc Chris Li <[email protected]>
Cc Yosry Ahmed <[email protected]>
Cc Baolin Wang <[email protected]>
Cc David Hildenbrand <[email protected]>
Cc "Huang, Ying" <[email protected]>
Cc Kairui Song <[email protected]>
Cc Ryan Roberts <[email protected]>
Cc Kanchana P Sridhar <[email protected]>
Cc Usama Arif <[email protected]>

LGTM.

Quoted 26 lines
---
  mm/page_io.c | 4 ++--
  1 file changed, 2 insertions(+), 2 deletions(-)
mm/page_io.c +2 -2
index a28d28b6b3ce..c69fab5060a1 100644
@@ -574,7 +574,7 @@ static void swap_read_folio_bdev_sync(struct folio *folio,
  	 */
  	get_task_struct(current);
  	count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio));
-	count_vm_event(PSWPIN);
+	count_vm_events(PSWPIN, folio_nr_pages(folio));
  	submit_bio_wait(&bio);
  	__end_swap_bio_read(&bio);
  	put_task_struct(current);
@@ -590,7 +590,7 @@ static void swap_read_folio_bdev_async(struct folio *folio,
  	bio->bi_end_io = end_swap_bio_read;
  	bio_add_folio_nofail(bio, folio, folio_size(folio), 0);
  	count_memcg_folio_events(folio, PSWPIN, folio_nr_pages(folio));
-	count_vm_event(PSWPIN);
+	count_vm_events(PSWPIN, folio_nr_pages(folio));
  	submit_bio(bio);
  }