From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83FB1C43461 for ; Thu, 17 Sep 2020 09:06:56 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id DCF30206BE for ; Thu, 17 Sep 2020 09:06:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org DCF30206BE Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 57BBD6B005A; Thu, 17 Sep 2020 05:06:55 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 52D316B005C; Thu, 17 Sep 2020 05:06:55 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 441656B005D; Thu, 17 Sep 2020 05:06:55 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0129.hostedemail.com [216.40.44.129]) by kanga.kvack.org (Postfix) with ESMTP id 280FC6B005A for ; Thu, 17 Sep 2020 05:06:55 -0400 (EDT) Received: from smtpin25.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id E72F5989A for ; Thu, 17 Sep 2020 09:06:54 +0000 (UTC) X-FDA: 77271973548.25.way91_270506b27121 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin25.hostedemail.com (Postfix) with ESMTP id C90E91807DC49 for ; Thu, 17 Sep 2020 09:06:54 +0000 (UTC) X-HE-Tag: way91_270506b27121 X-Filterd-Recvd-Size: 2714 Received: from mx2.suse.de (mx2.suse.de [195.135.220.15]) by imf10.hostedemail.com (Postfix) with ESMTP for ; Thu, 17 Sep 2020 09:06:54 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id EC534AE08; Thu, 17 Sep 2020 09:07:26 +0000 (UTC) Received: by quack2.suse.cz (Postfix, from userid 1000) id D5C071E12E1; Thu, 17 Sep 2020 11:06:52 +0200 (CEST) Date: Thu, 17 Sep 2020 11:06:52 +0200 From: Jan Kara To: Christoph Hellwig Cc: Jens Axboe , Song Liu , Hans de Goede , Richard Weinberger , Minchan Kim , linux-mtd@lists.infradead.org, dm-devel@redhat.com, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org, drbd-dev@lists.linbit.com, linux-raid@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org Subject: Re: [PATCH 09/12] mm: use SWP_SYNCHRONOUS_IO more intelligently Message-ID: <20200917090652.GB7347@quack2.suse.cz> References: <20200910144833.742260-1-hch@lst.de> <20200910144833.742260-10-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200910144833.742260-10-hch@lst.de> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspamd-Queue-Id: C90E91807DC49 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu 10-09-20 16:48:29, Christoph Hellwig 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 Looks good to me. You can add: Reviewed-by: Jan Kara Honza > --- > 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 > -- Jan Kara SUSE Labs, CR