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=-9.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 62836C433E0 for ; Tue, 21 Jul 2020 05:46:52 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2113220792 for ; Tue, 21 Jul 2020 05:46:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="D/IxIwyE" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2113220792 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 9ABF16B0006; Tue, 21 Jul 2020 01:46:51 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 95BCC6B0007; Tue, 21 Jul 2020 01:46:51 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 848E66B0008; Tue, 21 Jul 2020 01:46:51 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0252.hostedemail.com [216.40.44.252]) by kanga.kvack.org (Postfix) with ESMTP id 6F1A26B0006 for ; Tue, 21 Jul 2020 01:46:51 -0400 (EDT) Received: from smtpin12.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 09231C0B8BA7 for ; Tue, 21 Jul 2020 05:46:51 +0000 (UTC) X-FDA: 77060999022.12.sink01_2810fd526f2b Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin12.hostedemail.com (Postfix) with ESMTP id 6ECA31802AD23 for ; Tue, 21 Jul 2020 05:46:22 +0000 (UTC) X-HE-Tag: sink01_2810fd526f2b X-Filterd-Recvd-Size: 6256 Received: from mail-pj1-f68.google.com (mail-pj1-f68.google.com [209.85.216.68]) by imf43.hostedemail.com (Postfix) with ESMTP for ; Tue, 21 Jul 2020 05:46:22 +0000 (UTC) Received: by mail-pj1-f68.google.com with SMTP id f16so1108244pjt.0 for ; Mon, 20 Jul 2020 22:46:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=3veC3pi53wl7dFDGpjkOo+uS1itnPbzCOm4x4ko6JVY=; b=D/IxIwyEq3hF3iTuaIk+KFCFZyGC8VqcCGJnFT12TDv/8eGagJrHkXCGkF3Muc266t OGT7OoG2HtHbaXMhlknQISHa5De5A/xFpxWKJLCbc/SAIqTngBdVmIG3+rFG2+Y1Wb46 YATZPWszcpNmKSDpEHErZUkhido9bvZlai2206IHzthib3Y0UiQ6fX8Re2N3orWnF12s XZ6RPqQNT9T2QKcABfS3hJr1GCzgJFm/rDpCofJQA16hsZZMLUHK0fkaVJHJKDnTcvEP YayBMF/DStbLmLjOPFjbig16IweaRvLj4UCWCSitHEj/N0DuM+39Lm+dho9165oRwpKe XDKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to; bh=3veC3pi53wl7dFDGpjkOo+uS1itnPbzCOm4x4ko6JVY=; b=U4U2Z2osJU0hKF5m27bcX7Fv78t8T61LtOlDWlJ4qwsceJ/dxdt31h9eSaHmsZu/jN ARrHu/2XFavUOXuOw68UJQ6FapizyfdMe3ygz0IqHwO3wr2xrfhucTf3a0bOzfS/f/Fx uTsUP81vX//4OMFREzjvgpL/yK8F4SQopzg48q6QoqwS8+VMiunm5GEpsnef14urM/C/ qz5cVdTdwTDKbd1MAhjff8JIdp4u8dQvH9MLhWbuvSJzz7od2rStZibQVzaqzc44G1RZ bKRohqugo7KKDThcMKkl/T+FUkiS5EotYuDFz4Ywjq0HekHSNz6ztDTzCF8lNoLihpkB 7f5w== X-Gm-Message-State: AOAM5338mp0bc0LRAYjOuI74BwTsRXGWe7yUuK34KWTkXiCL3pc7ECn7 33vs4ohfrhdDpAl6ojnXh4Q= X-Google-Smtp-Source: ABdhPJylrFyWY9zOcJ3tuosterYe/etVkRG4BboKrT7kWFS6Sy9YPaV4NbuHkPEn95UZ4BSYHonUbw== X-Received: by 2002:a17:90a:dd44:: with SMTP id u4mr2794038pjv.203.1595310380927; Mon, 20 Jul 2020 22:46:20 -0700 (PDT) Received: from google.com ([2620:15c:211:1:7220:84ff:fe09:5e58]) by smtp.gmail.com with ESMTPSA id nh14sm1541134pjb.4.2020.07.20.22.46.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Jul 2020 22:46:19 -0700 (PDT) Date: Mon, 20 Jul 2020 22:46:17 -0700 From: Minchan Kim To: Shakeel Butt Cc: Christoph Hellwig , Jens Axboe , Song Liu , Hans de Goede , Richard Weinberger , linux-mtd@lists.infradead.org, dm-devel@redhat.com, "open list:BLOCK LAYER" , LKML , drbd-dev@lists.linbit.com, linux-raid@vger.kernel.org, linux-fsdevel , Linux MM , Cgroups Subject: Re: [PATCH 11/14] mm: use SWP_SYNCHRONOUS_IO more intelligently Message-ID: <20200721054617.GA1879427@google.com> References: <20200720075148.172156-1-hch@lst.de> <20200720075148.172156-12-hch@lst.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 6ECA31802AD23 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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: Thanks for Ccing me, Shakeel. On Mon, Jul 20, 2020 at 10:52:55AM -0700, Shakeel Butt wrote: > +Minchan Kim > > On Mon, Jul 20, 2020 at 12:52 AM 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. 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(). Yes, it needs post processing for error propagaion like *page* handling part in end_swap_bio_read(mostly, PG_error and PG_uptodate with pr_alert). bdev_read_page's sematic doesn't need to be synchronous so it could just submit the IO request and complete the IO afterward. In that case, we need right error handling, too if the IO encoutered error. BIO fallback makes it simple. * bdev_read_page() - Start reading a page from a block device * @bdev: The device to read the page from * @sector: The offset on the device to read the page to (need not be aligned) * @page: The page to read * * On entry, the page should be locked. It will be unlocked when the page * has been read. If the block driver implements rw_page synchronously, * that will be true on exit from this function, but it need not be. * * Errors returned by this function are usually "soft", eg out of memory, or * queue full; callers should try a different route to read this page rather * than propagate an error back up the stack. The other concern about this patch is zram have used rw_page for a long time even though sometime it doesn't declare BDI_CAP_SYNCHRONOUS_IO by itself because rw_page shows 4~5% bandwidth improvement compared to bio-based. The performance gain becomes more important these day because compressor becomes more fast day by day. > > > > > Signed-off-by: Christoph Hellwig > > --- > > 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 > >