Message ID | 20230328112716.50120-2-p.raghav@samsung.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2152996vqo; Tue, 28 Mar 2023 04:52:30 -0700 (PDT) X-Google-Smtp-Source: AKy350Z5CAfg4fRgVe1W3LYwNViCI53V+Q9wY7fHO4Jz6UXg9Rw8Wl9M8AtSaKL/0nr65MYCJ1la X-Received: by 2002:a17:906:9619:b0:922:446b:105a with SMTP id s25-20020a170906961900b00922446b105amr14742503ejx.19.1680004350047; Tue, 28 Mar 2023 04:52:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680004350; cv=none; d=google.com; s=arc-20160816; b=b7PqFnprEdSP5//rVhJLw2nbXoktRlx6gnYXbbeiSGndyjGP3AO4WVKh9FmwefMEr4 MlIQ0AOA0QvI/SxL6EmXjhBeHvBY7S0Hkotqjy3xrSK8e595TAG8CB37/Lma4VsCC6AT vK66u13U+ZJmdzP1wmAgUku+5ZCEL3j2QOcLWlhzCd0/JpT3tW30aTX2mmOVfmOW6kDQ BGfl7cHvzOkM4Zc5zhSawwyoO+ugSLyeJBoJnmqTekz6zJNx0O9jFEwZXUp7YFSLy/So ydEK5hhk90bvC2r09BP4P5fBQvJXw9GLxIWZ+2bXma+kaoWwnfa8uZR//GfAPG1HJzNv Pqog== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=V4uAY23rx6LbYgOeA+xAE8iXiLJZoHXfAuLkczsvSEk=; b=qQL11Y3VVoNageXIO5BlMpngKhLmbosQ7RHhof+daJ5/St437fIKa/Wmj55QVlrniH 8izp8io8VLTQaYbaE3g4Il7KT52gvSeIAR+RXHxQrekAuiIipZflUfo2bZ7LlwJwxxmP nIFmHh9ndO+Lc1GV/sYRlp1b8B6KWh/JpCnpOtFB486F5rApp8/rSktyzNgfFL0rjwDu DJB4fmt41538lAcbPW8+2B0b9lGzp+KCNVC+GCtQeZaghg5XWLmJ8MIv3Xo4ic2yii94 3lZDWViuBfQhINSItPTGXgvZWsPCawZQrYJ9m9j1zFDXR9CpP7dmcFNf/+g6kESfJgSL GDhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=g693ybUR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n8-20020a170906b30800b0093182033b89si29989606ejz.711.2023.03.28.04.52.06; Tue, 28 Mar 2023 04:52:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=g693ybUR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232750AbjC1L1f (ORCPT <rfc822;kartikey406@gmail.com> + 99 others); Tue, 28 Mar 2023 07:27:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229924AbjC1L11 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 28 Mar 2023 07:27:27 -0400 Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F02151725 for <linux-kernel@vger.kernel.org>; Tue, 28 Mar 2023 04:27:22 -0700 (PDT) Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20230328112720euoutp02d90d9589d523f3e9ace674ea1cfc5a3c~Qka66aPsT3247732477euoutp02j for <linux-kernel@vger.kernel.org>; Tue, 28 Mar 2023 11:27:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20230328112720euoutp02d90d9589d523f3e9ace674ea1cfc5a3c~Qka66aPsT3247732477euoutp02j DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1680002840; bh=V4uAY23rx6LbYgOeA+xAE8iXiLJZoHXfAuLkczsvSEk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g693ybURzQsLeFqRIYnYKiIo8yQ5CSmuybp+IfxL5pizPUyGj5Xjvcc47ckjr6oE+ EZp90lFWAUo/dtTnIQq4K++4Nw8sJMVdCasU2R8ZIatq3y1Sdasl5IXoX/tb3BhFNt 2fdzj4sATJg3SRSu4rcTvDpIZF19GYjbawOxHtBY= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20230328112718eucas1p2a740048df8ba642e0aa035d009115284~Qka5NmZGW2759927599eucas1p28; Tue, 28 Mar 2023 11:27:18 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 34.51.09503.61FC2246; Tue, 28 Mar 2023 12:27:18 +0100 (BST) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p2.samsung.com (KnoxPortal) with ESMTPA id 20230328112718eucas1p214a859cfb3d7b45523356bcc16c373b1~Qka44T5zZ0111901119eucas1p2j; Tue, 28 Mar 2023 11:27:18 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230328112718eusmtrp16f41b0a32e8b05be0788a2ac4a06450a~Qka43kbO80876308763eusmtrp1S; Tue, 28 Mar 2023 11:27:18 +0000 (GMT) X-AuditID: cbfec7f2-e8fff7000000251f-78-6422cf16dae4 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id FD.19.08862.61FC2246; Tue, 28 Mar 2023 12:27:18 +0100 (BST) Received: from localhost (unknown [106.210.248.108]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230328112718eusmtip24e9e179b1b56e4e1504088728ba93515~Qka4o8oxA2590125901eusmtip29; Tue, 28 Mar 2023 11:27:18 +0000 (GMT) From: Pankaj Raghav <p.raghav@samsung.com> To: martin@omnibond.com, axboe@kernel.dk, minchan@kernel.org, akpm@linux-foundation.org, hubcap@omnibond.com, willy@infradead.org, viro@zeniv.linux.org.uk, senozhatsky@chromium.org, brauner@kernel.org Cc: linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, mcgrof@kernel.org, linux-block@vger.kernel.org, gost.dev@samsung.com, linux-mm@kvack.org, devel@lists.orangefs.org, Pankaj Raghav <p.raghav@samsung.com> Subject: [PATCH 1/5] zram: remove the call to page_endio in the bio end_io handler Date: Tue, 28 Mar 2023 13:27:12 +0200 Message-Id: <20230328112716.50120-2-p.raghav@samsung.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230328112716.50120-1-p.raghav@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrLKsWRmVeSWpSXmKPExsWy7djP87pi55VSDO5u0bWYs34Nm8Xqu/1s Fq8Pf2K02L95CpPFzQM7mSza7/YxWey9pW2xZ+9JFovLu+awWdxb85/V4uT6/8wWNyY8ZbRY 9vU9u8XnpS3sFrs3LmKzOP/3OKvF7x9z2BwEPW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wetuJC7v6jyy5E6fEUpyRaKjFXFScCADMRL1hXwMAAA== X-CMS-MailID: 20230328112718eucas1p214a859cfb3d7b45523356bcc16c373b1 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-RootMTR: 20230328112718eucas1p214a859cfb3d7b45523356bcc16c373b1 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20230328112718eucas1p214a859cfb3d7b45523356bcc16c373b1 References: <20230328112716.50120-1-p.raghav@samsung.com> <CGME20230328112718eucas1p214a859cfb3d7b45523356bcc16c373b1@eucas1p2.samsung.com> X-Spam-Status: No, score=-5.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761612241444051081?= X-GMAIL-MSGID: =?utf-8?q?1761612241444051081?= |
Series |
remove page_endio()
|
|
Commit Message
Pankaj Raghav
March 28, 2023, 11:27 a.m. UTC
zram_page_end_io function is called when alloc_page is used (for
partial IO) to trigger writeback from the user space. The pages used for
this operation is never locked or have the writeback set. So, it is safe
to remove the call to page_endio() function that unlocks or marks
writeback end on the page.
Rename the endio handler from zram_page_end_io to zram_read_end_io as
the call to page_endio() is removed and to associate the callback to the
operation it is used in.
Signed-off-by: Pankaj Raghav <p.raghav@samsung.com>
---
drivers/block/zram/zram_drv.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
Comments
On Tue, Mar 28, 2023 at 01:27:12PM +0200, Pankaj Raghav wrote: > -static void zram_page_end_io(struct bio *bio) > +static void zram_read_end_io(struct bio *bio) > { > - struct page *page = bio_first_page_all(bio); > - > - page_endio(page, op_is_write(bio_op(bio)), > - blk_status_to_errno(bio->bi_status)); > bio_put(bio); > } > > @@ -635,7 +631,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, > } > > if (!parent) > - bio->bi_end_io = zram_page_end_io; > + bio->bi_end_io = zram_read_end_io; Can we just do: if (!parent) bio->bi_end_io = bio_put; drivers/nvme/target/passthru.c does this, so it wouldn't be the first.
On 2023-03-28 17:19, Matthew Wilcox wrote: > On Tue, Mar 28, 2023 at 01:27:12PM +0200, Pankaj Raghav wrote: >> -static void zram_page_end_io(struct bio *bio) >> +static void zram_read_end_io(struct bio *bio) >> { >> - struct page *page = bio_first_page_all(bio); >> - >> - page_endio(page, op_is_write(bio_op(bio)), >> - blk_status_to_errno(bio->bi_status)); >> bio_put(bio); >> } >> >> @@ -635,7 +631,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, >> } >> >> if (!parent) >> - bio->bi_end_io = zram_page_end_io; >> + bio->bi_end_io = zram_read_end_io; > > Can we just do: > > if (!parent) > bio->bi_end_io = bio_put; > Looks neat. I will wait for Christoph to comment whether just a bio_put() call is enough in this case for non-chained bios before making this change for the next version. Thanks.
On Tue, Mar 28, 2023 at 06:17:11PM +0200, Pankaj Raghav wrote: > >> if (!parent) > >> - bio->bi_end_io = zram_page_end_io; > >> + bio->bi_end_io = zram_read_end_io; > > > > Can we just do: > > > > if (!parent) > > bio->bi_end_io = bio_put; > > > > Looks neat. I will wait for Christoph to comment whether just a bio_put() call > is enough in this case for non-chained bios before making this change for the > next version. It is enough in the sense of keeping the previous behavior there. It is not enough in the sense that the code is still broken as the callers is never notified of the read completion. So I think for the purpose of your series we're fine and can go ahead with this version for now. > > Thanks. ---end quoted text---
On Tue, Mar 28, 2023 at 01:27:12PM +0200, Pankaj Raghav wrote: > zram_page_end_io function is called when alloc_page is used (for > partial IO) to trigger writeback from the user space. The pages used for No, it was used with zram_rw_page since rw_page didn't carry the bio. > this operation is never locked or have the writeback set. So, it is safe VM had the page lock and wait to unlock. > to remove the call to page_endio() function that unlocks or marks > writeback end on the page. > > Rename the endio handler from zram_page_end_io to zram_read_end_io as > the call to page_endio() is removed and to associate the callback to the > operation it is used in. Since zram removed the rw_page and IO comes with bio from now on, IIUC, we are fine since every IO will go with chained-IO. Right? > > Signed-off-by: Pankaj Raghav <p.raghav@samsung.com> > --- > drivers/block/zram/zram_drv.c | 8 ++------ > 1 file changed, 2 insertions(+), 6 deletions(-) > > diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c > index b7bb52f8dfbd..3300e7eda2f6 100644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -606,12 +606,8 @@ static void free_block_bdev(struct zram *zram, unsigned long blk_idx) > atomic64_dec(&zram->stats.bd_count); > } > > -static void zram_page_end_io(struct bio *bio) > +static void zram_read_end_io(struct bio *bio) > { > - struct page *page = bio_first_page_all(bio); > - > - page_endio(page, op_is_write(bio_op(bio)), > - blk_status_to_errno(bio->bi_status)); > bio_put(bio); > } > > @@ -635,7 +631,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, > } > > if (!parent) > - bio->bi_end_io = zram_page_end_io; > + bio->bi_end_io = zram_read_end_io; > else > bio_chain(bio, parent); > > -- > 2.34.1 >
On Thu, Mar 30, 2023 at 03:51:54PM -0700, Minchan Kim wrote: > > to remove the call to page_endio() function that unlocks or marks > > writeback end on the page. > > > > Rename the endio handler from zram_page_end_io to zram_read_end_io as > > the call to page_endio() is removed and to associate the callback to the > > operation it is used in. > > Since zram removed the rw_page and IO comes with bio from now on, > IIUC, we are fine since every IO will go with chained-IO. Right? writeback_store callszram_bvec_read with a NULL bio, that is it just fires off an async read without any synchronization.
On Thu, Mar 30, 2023 at 04:16:25PM -0700, Christoph Hellwig wrote: > On Thu, Mar 30, 2023 at 03:51:54PM -0700, Minchan Kim wrote: > > > to remove the call to page_endio() function that unlocks or marks > > > writeback end on the page. > > > > > > Rename the endio handler from zram_page_end_io to zram_read_end_io as > > > the call to page_endio() is removed and to associate the callback to the > > > operation it is used in. > > > > Since zram removed the rw_page and IO comes with bio from now on, > > IIUC, we are fine since every IO will go with chained-IO. Right? > > writeback_store callszram_bvec_read with a NULL bio, that is it just > fires off an async read without any synchronization. It should go under zram_read_from_zspool, not zram_bvec_read_from_bdev. The ZRAM_UNDER_WB and ZRAM_WB under zram_slot_lock should synchronize.
On 2023-03-31 00:51, Minchan Kim wrote: > On Tue, Mar 28, 2023 at 01:27:12PM +0200, Pankaj Raghav wrote: >> zram_page_end_io function is called when alloc_page is used (for >> partial IO) to trigger writeback from the user space. The pages used for > > No, it was used with zram_rw_page since rw_page didn't carry the bio. > >> this operation is never locked or have the writeback set. So, it is safe > > VM had the page lock and wait to unlock. > >> to remove the call to page_endio() function that unlocks or marks >> writeback end on the page. >> >> Rename the endio handler from zram_page_end_io to zram_read_end_io as >> the call to page_endio() is removed and to associate the callback to the >> operation it is used in. > I revisited the code again. Let me know if I got it right. When we trigger writeback, we will always call zram_bvec_read() only if ZRAM_WB is not set. That means we will only call zram_read_from_zspool() in __zram_bvec_read when parent bio set to NULL. static ssize_t writeback_store(struct device *dev, ... { if (zram_test_flag(zram, index, ZRAM_WB) || zram_test_flag(zram, index, ZRAM_SAME) || zram_test_flag(zram, index, ZRAM_UNDER_WB)) goto next; ... if (zram_bvec_read(zram, &bvec, index, 0, NULL)) { ... } static int __zram_bvec_read(struct zram *zram, struct page *page, u32 index, struct bio *bio, bool partial_io) { .... if (!zram_test_flag(zram, index, ZRAM_WB)) { /* Slot should be locked through out the function call */ ret = zram_read_from_zspool(zram, page, index); zram_slot_unlock(zram, index); } else { /* Slot should be unlocked before the function call */ zram_slot_unlock(zram, index); ret = zram_bvec_read_from_bdev(zram, page, index, bio, partial_io); } .... } > Since zram removed the rw_page and IO comes with bio from now on, > IIUC, we are fine since every IO will go with chained-IO. Right? > We will never call zram_bvec_read_from_bdev() with parent bio set to NULL. IOW, we will always only hit the bio_chain case in read_from_bdev_async. So we could do the following?: diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index b7bb52f8dfbd..2341f4009b0f 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -606,15 +606,6 @@ static void free_block_bdev(struct zram *zram, unsigned long blk_idx) atomic64_dec(&zram->stats.bd_count); } -static void zram_page_end_io(struct bio *bio) -{ - struct page *page = bio_first_page_all(bio); - - page_endio(page, op_is_write(bio_op(bio)), - blk_status_to_errno(bio->bi_status)); - bio_put(bio); -} - /* * Returns 1 if the submission is successful. */ @@ -634,9 +625,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, return -EIO; } - if (!parent) - bio->bi_end_io = zram_page_end_io; - else + if (parent) bio_chain(bio, parent); submit_bio(bio);
diff --git a/drivers/block/zram/zram_drv.c b/drivers/block/zram/zram_drv.c index b7bb52f8dfbd..3300e7eda2f6 100644 --- a/drivers/block/zram/zram_drv.c +++ b/drivers/block/zram/zram_drv.c @@ -606,12 +606,8 @@ static void free_block_bdev(struct zram *zram, unsigned long blk_idx) atomic64_dec(&zram->stats.bd_count); } -static void zram_page_end_io(struct bio *bio) +static void zram_read_end_io(struct bio *bio) { - struct page *page = bio_first_page_all(bio); - - page_endio(page, op_is_write(bio_op(bio)), - blk_status_to_errno(bio->bi_status)); bio_put(bio); } @@ -635,7 +631,7 @@ static int read_from_bdev_async(struct zram *zram, struct bio_vec *bvec, } if (!parent) - bio->bi_end_io = zram_page_end_io; + bio->bi_end_io = zram_read_end_io; else bio_chain(bio, parent);