Re: [PATCH 11/14] mm: use SWP_SYNCHRONOUS_IO more intelligently

From
Shakeel Butt <hidden>
Date
2020-07-20 17:53:13
Also in
cgroups, dm-devel, linux-block, linux-fsdevel, linux-mm, lkml
Reply to
Christoph Hellwig, 2020-07-20
+Minchan Kim

On Mon, Jul 20, 2020 at 12:52 AM Christoph Hellwig [off-list ref] wrote:
There is no point in trying to call bdev_read_page if SWP_SYNCHRONOUS_IO
is not set, as the device won't support it.  Also there is no point in
trying a bio submission if bdev_read_page failed.
This will at least break the failure path of zram_rw_page().
quoted hunk ↗ jump to hunk
Signed-off-by: Christoph Hellwig <hch@lst.de>
---
 mm/page_io.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index ccda7679008851..63b44b8221af0f 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -403,8 +403,11 @@ int swap_readpage(struct page *page, bool synchronous)
                goto out;
        }

-       ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
-       if (!ret) {
+       if (sis->flags & SWP_SYNCHRONOUS_IO) {
+               ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
+               if (ret)
+                       goto out;
+
                if (trylock_page(page)) {
                        swap_slot_free_notify(page);
                        unlock_page(page);
--
2.27.0
Thread (22 messages) 22 messages, 5 authors, last reply 2020-07-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help