linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@infradead.org>
To: Pavel Begunkov <asml.silence@gmail.com>
Cc: Christoph Hellwig <hch@infradead.org>,
	Matthew Wilcox <willy@infradead.org>,
	Ming Lei <ming.lei@redhat.com>, Jens Axboe <axboe@kernel.dk>,
	linux-block@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	Johannes Weiner <hannes@cmpxchg.org>
Subject: Re: [PATCH] block: add bio_iov_iter_nvecs for figuring out nr_vecs
Date: Tue, 1 Dec 2020 13:32:26 +0000	[thread overview]
Message-ID: <20201201133226.GA26472@infradead.org> (raw)
In-Reply-To: <fdbfe981-0251-9641-6ed8-db034c0f0148@gmail.com>

On Tue, Dec 01, 2020 at 01:17:49PM +0000, Pavel Begunkov wrote:
> I was thinking about memcpy bvec instead of iterating as a first step,
> and then try to reuse passed in bvec.
> 
> A thing that doesn't play nice with that is setting BIO_WORKINGSET in
> __bio_add_page(), which requires to iterate all pages anyway. I have no
> clue what it is, so rather to ask if we can optimise it out somehow?
> Apart from pre-computing for specific cases...
> 
> E.g. can pages of a single bvec segment be both in and out of a working
> set? (i.e. PageWorkingset(page)).

Adding Johannes for the PageWorkingset logic, which keeps confusing me
everytime I look at it.  I think it is intended to deal with pages
being swapped out and in, and doesn't make much sense to look at in
any form for direct I/O, but as said I'm rather confused by this code.

If PageWorkingset is a non-issue we should be able to just point the
bio at the biovec array.  I think that be done by allocating the bio
with nr_iovecs == 0, and then just updating >bi_io_vec and ->bi_vcnt
using a little helper like this:

static inline void bio_assign_bvec(struct bio *bio, struct bio_vec *bvecs,
		unsigned short nr_bvecs)
{
	WARN_ON_ONCE(BVEC_POOL_IDX(bio) != 0);
	bio->bi_io_vec = bvecs;
	bio->bi_vcnt = nr_bvecs;
}

  reply	other threads:[~2020-12-01 13:33 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-01 12:06 [PATCH] block: add bio_iov_iter_nvecs for figuring out nr_vecs Ming Lei
2020-12-01 12:52 ` Matthew Wilcox
2020-12-01 12:59   ` Christoph Hellwig
2020-12-01 13:17     ` Pavel Begunkov
2020-12-01 13:32       ` Christoph Hellwig [this message]
2020-12-01 13:36         ` Pavel Begunkov
2020-12-01 13:45           ` Christoph Hellwig
2020-12-01 13:48             ` Pavel Begunkov
2020-12-02  2:10             ` Ming Lei
2020-12-02  8:02               ` Christoph Hellwig
2020-12-03 22:36         ` Johannes Weiner
2020-12-03 23:43           ` Pavel Begunkov
2020-12-04 12:48           ` Christoph Hellwig
2020-12-10 13:18             ` Johannes Weiner
2020-12-11 13:22               ` Pavel Begunkov
2020-12-02  1:46   ` Ming Lei
2020-12-02 14:06 ` Pavel Begunkov
2020-12-02 15:02 ` Christoph Hellwig
2020-12-02 16:56 ` Jens Axboe
2020-12-07 18:07 ` Pavel Begunkov
2020-12-08  1:21   ` Ming Lei
2020-12-08  1:50   ` Ming Lei
2020-12-08  2:54     ` Pavel Begunkov

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=20201201133226.GA26472@infradead.org \
    --to=hch@infradead.org \
    --cc=asml.silence@gmail.com \
    --cc=axboe@kernel.dk \
    --cc=hannes@cmpxchg.org \
    --cc=linux-block@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=ming.lei@redhat.com \
    --cc=willy@infradead.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;
as well as URLs for NNTP newsgroup(s).