[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CALvZod6zF7Ak8KWf4dq0pEF2ty7JN_SyNE7PxLjrfF+EuDbZ2w@mail.gmail.com>
Date: Wed, 22 Jul 2020 09:26:45 -0700
From: Shakeel Butt <shakeelb@...gle.com>
To: Christoph Hellwig <hch@....de>
Cc: Jens Axboe <axboe@...nel.dk>, Song Liu <song@...nel.org>,
Hans de Goede <hdegoede@...hat.com>,
Richard Weinberger <richard@....at>,
Minchan Kim <minchan@...nel.org>,
linux-mtd@...ts.infradead.org, dm-devel@...hat.com,
"open list:BLOCK LAYER" <linux-block@...r.kernel.org>,
LKML <linux-kernel@...r.kernel.org>, drbd-dev@...ts.linbit.com,
linux-raid@...r.kernel.org,
linux-fsdevel <linux-fsdevel@...r.kernel.org>,
Linux MM <linux-mm@...ck.org>,
Cgroups <cgroups@...r.kernel.org>
Subject: Re: [PATCH 11/14] mm: use SWP_SYNCHRONOUS_IO more intelligently
On Tue, Jul 21, 2020 at 11:27 PM Christoph Hellwig <hch@....de> 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.
>
> Signed-off-by: Christoph Hellwig <hch@....de>
> ---
> 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 ccda7679008851..442061348dfb26 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) {
!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.27.0
>
Powered by blists - more mailing lists