]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - mm/page_io.c
futex: arch_futex_atomic_op_inuser() calling conventions change
[mirror_ubuntu-jammy-kernel.git] / mm / page_io.c
index 60a66a58b9bf9ab0922b545b15da739eb4fd5dd0..76965be1d40ea5a83800a03d3a4e0a31ddbe5905 100644 (file)
@@ -22,6 +22,7 @@
 #include <linux/writeback.h>
 #include <linux/frontswap.h>
 #include <linux/blkdev.h>
+#include <linux/psi.h>
 #include <linux/uio.h>
 #include <linux/sched/task.h>
 #include <asm/pgtable.h>
@@ -176,8 +177,9 @@ int generic_swapfile_activate(struct swap_info_struct *sis,
 
                cond_resched();
 
-               first_block = bmap(inode, probe_block);
-               if (first_block == 0)
+               first_block = probe_block;
+               ret = bmap(inode, &first_block);
+               if (ret || !first_block)
                        goto bad_bmap;
 
                /*
@@ -192,9 +194,11 @@ int generic_swapfile_activate(struct swap_info_struct *sis,
                                        block_in_page++) {
                        sector_t block;
 
-                       block = bmap(inode, probe_block + block_in_page);
-                       if (block == 0)
+                       block = probe_block + block_in_page;
+                       ret = bmap(inode, &block);
+                       if (ret || !block)
                                goto bad_bmap;
+
                        if (block != first_block + block_in_page) {
                                /* Discontiguity */
                                probe_block++;
@@ -354,10 +358,19 @@ int swap_readpage(struct page *page, bool synchronous)
        struct swap_info_struct *sis = page_swap_info(page);
        blk_qc_t qc;
        struct gendisk *disk;
+       unsigned long pflags;
 
        VM_BUG_ON_PAGE(!PageSwapCache(page) && !synchronous, page);
        VM_BUG_ON_PAGE(!PageLocked(page), page);
        VM_BUG_ON_PAGE(PageUptodate(page), page);
+
+       /*
+        * Count submission time as memory stall. When the device is congested,
+        * or the submitting cgroup IO-throttled, submission can be a
+        * significant part of overall IO time.
+        */
+       psi_memstall_enter(&pflags);
+
        if (frontswap_load(page) == 0) {
                SetPageUptodate(page);
                unlock_page(page);
@@ -371,7 +384,7 @@ int swap_readpage(struct page *page, bool synchronous)
                ret = mapping->a_ops->readpage(swap_file, page);
                if (!ret)
                        count_vm_event(PSWPIN);
-               return ret;
+               goto out;
        }
 
        ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
@@ -382,7 +395,7 @@ int swap_readpage(struct page *page, bool synchronous)
                }
 
                count_vm_event(PSWPIN);
-               return 0;
+               goto out;
        }
 
        ret = 0;
@@ -418,6 +431,7 @@ int swap_readpage(struct page *page, bool synchronous)
        bio_put(bio);
 
 out:
+       psi_memstall_leave(&pflags);
        return ret;
 }