struct swap_info_struct *sis = page_swap_info(page);
        bool workingset = PageWorkingset(page);
        unsigned long pflags;
+       bool in_thrashing;
 
        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.
+        * Count submission time as memory stall and delay. When the device
+        * is congested, or the submitting cgroup IO-throttled, submission
+        * can be a significant part of overall IO time.
         */
-       if (workingset)
+       if (workingset) {
+               delayacct_thrashing_start(&in_thrashing);
                psi_memstall_enter(&pflags);
+       }
        delayacct_swapin_start();
 
        if (frontswap_load(page) == 0) {
        bio_put(bio);
 
 out:
-       if (workingset)
+       if (workingset) {
+               delayacct_thrashing_end(&in_thrashing);
                psi_memstall_leave(&pflags);
+       }
        delayacct_swapin_end();
        return ret;
 }