Linux block layer
 help / color / mirror / Atom feed
From: Minwoo Im <minwoo.im.dev@gmail.com>
To: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: Christoph Hellwig <hch@lst.de>, Jens Axboe <axboe@kernel.dk>,
	"linux-block@vger.kernel.org" <linux-block@vger.kernel.org>,
	Minwoo Im <minwoo.im.dev@gmail.com>
Subject: Re: [PATCH 2/9] block: optionally mark pages dirty in bio_release_pages
Date: Thu, 27 Jun 2019 19:24:26 +0900	[thread overview]
Message-ID: <20190627102426.GB4421@minwooim-desktop> (raw)
In-Reply-To: <108F1585-0711-4D2C-9E99-0E404D4E173B@wdc.com>

On 19-06-27 00:21:27, Chaitanya Kulkarni wrote:
> 
> 
> On 6/26/19, 1:52 PM, "linux-block-owner@vger.kernel.org on behalf of Minwoo Im" <linux-block-owner@vger.kernel.org on behalf of minwoo.im.dev@gmail.com> wrote:
> 
>     On 19-06-26 15:49:21, Christoph Hellwig wrote:
>     > A lot of callers of bio_release_pages also want to mark the released
>     > pages as dirty.  Add a mark_dirty parameter to avoid a second
>     > relatively expensive bio_for_each_segment_all loop.
>     > 
>     > Signed-off-by: Christoph Hellwig <hch@lst.de>
>     > ---
>     >  block/bio.c         | 12 +++++++-----
>     >  include/linux/bio.h |  2 +-
>     >  2 files changed, 8 insertions(+), 6 deletions(-)
>     > 
>     > diff --git a/block/bio.c b/block/bio.c
>     > index 9bc7d28ae997..7f3920b6baca 100644
>     > --- a/block/bio.c
>     > +++ b/block/bio.c
>     > @@ -845,7 +845,7 @@ static void bio_get_pages(struct bio *bio)
>     >  		get_page(bvec->bv_page);
>     >  }
>     >  
>     > -void bio_release_pages(struct bio *bio)
>     > +void bio_release_pages(struct bio *bio, bool mark_dirty)
>     >  {
>     >  	struct bvec_iter_all iter_all;
>     >  	struct bio_vec *bvec;
>     > @@ -853,8 +853,11 @@ void bio_release_pages(struct bio *bio)
>     >  	if (bio_flagged(bio, BIO_NO_PAGE_REF))
>     >  		return;
>     >  
>     > -	bio_for_each_segment_all(bvec, bio, iter_all)
>     > +	bio_for_each_segment_all(bvec, bio, iter_all) {
>     > +		if (mark_dirty && !PageCompound(bvec->bv_page))
>     > +			set_page_dirty_lock(bvec->bv_page);
>     
>     Christoph,
>     
>     Could you please explain a bit why we should not make it dirty in case
>     of compound page?
> 
> Maybe because of [PATCH 7/9] block_dev: use bio_release_pages in bio_unmap_user :-
> 
> @@ -259,13 +258,7 @@ __blkdev_direct_IO_simple(struct kiocb *iocb, struct iov_iter *iter,
> 	}
> 	__set_current_state(TASK_RUNNING);
> -	bio_for_each_segment_all(bvec, &bio, iter_all) {
> -		if (should_dirty && !PageCompound(bvec->bv_page))
> -			set_page_dirty_lock(bvec->bv_page);
> -		if (!bio_flagged(&bio, BIO_NO_PAGE_REF))
> -			put_page(bvec->bv_page);
> -	}
> -
> +	bio_release_pages(&bio, should_dirty);
> 
> I'll let Christoph confirm that.

Chaitanya,

Thanks for sharing this.  Actually I have seen that commit log but
didn't catch up why the compound pages are so.  Now I understood what
Christoph has mentioned.

Thanks for your help, again.

  reply	other threads:[~2019-06-27 10:24 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-26 13:49 cleanup bio page releasing Christoph Hellwig
2019-06-26 13:49 ` [PATCH 1/9] block: move the BIO_NO_PAGE_REF check into bio_release_pages Christoph Hellwig
2019-06-26 20:34   ` Minwoo Im
2019-06-26 13:49 ` [PATCH 2/9] block: optionally mark pages dirty in bio_release_pages Christoph Hellwig
2019-06-26 20:52   ` Minwoo Im
2019-06-27  0:21     ` Chaitanya Kulkarni
2019-06-27 10:24       ` Minwoo Im [this message]
2019-06-27  8:27     ` Christoph Hellwig
2019-06-27 10:22       ` Minwoo Im
2019-06-26 13:49 ` [PATCH 3/9] block: use bio_release_pages in bio_unmap_user Christoph Hellwig
2019-06-26 20:47   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 4/9] block: use bio_release_pages in bio_map_user_iov Christoph Hellwig
2019-06-26 20:41   ` Minwoo Im
2019-06-26 20:47   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 5/9] iomap: use bio_release_pages in iomap_dio_bio_end_io Christoph Hellwig
2019-06-26 20:42   ` Minwoo Im
2019-06-26 20:47   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 6/9] block_dev: use bio_release_pages in blkdev_bio_end_io Christoph Hellwig
2019-06-26 20:44   ` Minwoo Im
2019-06-26 20:47   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 7/9] block_dev: use bio_release_pages in bio_unmap_user Christoph Hellwig
2019-06-26 20:48   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 8/9] direct-io: use bio_release_pages in dio_bio_complete Christoph Hellwig
2019-06-26 20:49   ` Chaitanya Kulkarni
2019-06-26 13:49 ` [PATCH 9/9] block: never take page references for ITER_BVEC Christoph Hellwig
2019-06-26 20:57   ` Minwoo Im
2019-06-29 15:48 ` cleanup bio page releasing Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190627102426.GB4421@minwooim-desktop \
    --to=minwoo.im.dev@gmail.com \
    --cc=Chaitanya.Kulkarni@wdc.com \
    --cc=axboe@kernel.dk \
    --cc=hch@lst.de \
    --cc=linux-block@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox