]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
mm: fix PSWPIN counter for large folios swap-in
authorBarry Song <v-songbaohua@oppo.com>
Wed, 23 Oct 2024 21:02:01 +0000 (10:02 +1300)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 31 Oct 2024 03:14:11 +0000 (20:14 -0700)
Similar to PSWPOUT, we should count the number of base pages instead of
large folios.

Link: https://lkml.kernel.org/r/20241023210201.2798-1-21cnbao@gmail.com
Fixes: 242d12c98174 ("mm: support large folios swap-in for sync io devices")
Signed-off-by: Barry Song <v-songbaohua@oppo.com>
Acked-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
Cc: Chris Li <chrisl@kernel.org>
Cc: Yosry Ahmed <yosryahmed@google.com>
Cc: "Huang, Ying" <ying.huang@intel.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Kanchana P Sridhar <kanchana.p.sridhar@intel.com>
Cc: Usama Arif <usamaarif642@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/page_io.c

index 78bc88acee795888187744780eb9c51d4dd24479..69536a2b3c138683209b9ff012f44e7f81191d02 100644 (file)
@@ -570,7 +570,7 @@ static void swap_read_folio_bdev_sync(struct folio *folio,
         * attempt to access it in the page fault retry time check.
         */
        get_task_struct(current);
-       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);
@@ -585,7 +585,7 @@ static void swap_read_folio_bdev_async(struct folio *folio,
        bio->bi_iter.bi_sector = swap_folio_sector(folio);
        bio->bi_end_io = end_swap_bio_read;
        bio_add_folio_nofail(bio, folio, folio_size(folio), 0);
-       count_vm_event(PSWPIN);
+       count_vm_events(PSWPIN, folio_nr_pages(folio));
        submit_bio(bio);
 }