[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200921080734.452759-11-hch@lst.de>
Date: Mon, 21 Sep 2020 10:07:31 +0200
From: Christoph Hellwig <hch@....de>
To: Jens Axboe <axboe@...nel.dk>
Cc: Song Liu <song@...nel.org>, Hans de Goede <hdegoede@...hat.com>,
Coly Li <colyli@...e.de>, Richard Weinberger <richard@....at>,
Minchan Kim <minchan@...nel.org>,
Johannes Thumshirn <Johannes.Thumshirn@....com>,
Justin Sanders <justin@...aid.com>,
linux-mtd@...ts.infradead.org, dm-devel@...hat.com,
linux-block@...r.kernel.org, linux-bcache@...r.kernel.org,
linux-kernel@...r.kernel.org, drbd-dev@...ts.linbit.com,
linux-raid@...r.kernel.org, linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org, cgroups@...r.kernel.org,
Jan Kara <jack@...e.cz>,
Johannes Thumshirn <johannes.thumshirn@....com>
Subject: [PATCH 10/13] mm: use SWP_SYNCHRONOUS_IO more intelligently
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.
Signed-off-by: Christoph Hellwig <hch@....de>
Reviewed-by: Jan Kara <jack@...e.cz>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@....com>
---
mm/page_io.c | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/mm/page_io.c b/mm/page_io.c
index e485a6e8a6cddb..b199b87e0aa92b 100644
--- a/mm/page_io.c
+++ b/mm/page_io.c
@@ -403,15 +403,17 @@ int swap_readpage(struct page *page, bool synchronous)
goto out;
}
- ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
- if (!ret) {
- if (trylock_page(page)) {
- swap_slot_free_notify(page);
- unlock_page(page);
- }
+ if (sis->flags & SWP_SYNCHRONOUS_IO) {
+ ret = bdev_read_page(sis->bdev, swap_page_sector(page), page);
+ if (!ret) {
+ if (trylock_page(page)) {
+ swap_slot_free_notify(page);
+ unlock_page(page);
+ }
- count_vm_event(PSWPIN);
- goto out;
+ count_vm_event(PSWPIN);
+ goto out;
+ }
}
ret = 0;
--
2.28.0
Powered by blists - more mailing lists