From: Dave Chinner <david@fromorbit.com>
To: Ming Lei <ming.lei@redhat.com>
Cc: Christoph Hellwig <hch@lst.de>,
Matthew Wilcox <willy@infradead.org>,
Jens Axboe <axboe@kernel.dk>,
linux-block@vger.kernel.org,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Dave Chinner <dchinner@redhat.com>,
Linux FS Devel <linux-fsdevel@vger.kernel.org>,
"Darrick J . Wong" <darrick.wong@oracle.com>,
linux-xfs@vger.kernel.org, Bart Van Assche <bvanassche@acm.org>
Subject: Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab
Date: Fri, 19 Oct 2018 16:43:19 +1100 [thread overview]
Message-ID: <20181019054319.GL6311@dastard> (raw)
In-Reply-To: <20181019025348.GB14531@ming.t460p>
On Fri, Oct 19, 2018 at 10:53:49AM +0800, Ming Lei wrote:
> On Thu, Oct 18, 2018 at 05:22:19PM +0200, Christoph Hellwig wrote:
> > On Thu, Oct 18, 2018 at 08:11:23AM -0700, Matthew Wilcox wrote:
> > > On Thu, Oct 18, 2018 at 04:42:07PM +0200, Christoph Hellwig wrote:
> > > > This all seems quite complicated.
> > > >
> > > > I think the interface we'd want is more one that has a little
> > > > cache of a single page in the queue, and a little bitmap which
> > > > sub-page size blocks of it are used.
> > > >
> > > > Something like (pseudo code minus locking):
> > > >
> > > > void *blk_alloc_sector_buffer(struct block_device *bdev, gfp_t gfp)
> > > > {
> > > > unsigned block_size = block_size(bdev);
> > > >
> > > > if (blocksize >= PAGE_SIZE)
> > > > return (void *)__get_free_pages(gfp, get_order(blocksize));
> > > >
> > > > if (bdev->fragment_cache_page) {
> > > > [ <find fragment in bdev->fragment_cache_page using
> > > > e.g. bitmap and return if found]
> > > > }
> > > >
> > > > bdev->fragment_cache_page = (void *)__get_free_page(gfp);
> > > > goto find_again;
> > > > }
> > >
> > > This looks a lot like page_frag_alloc() except I think page_frag_alloc()
> > > may be more efficient.
> >
> > Oh, nice. Sounds like XFS should just use page_frag_alloc. I'll give
> > it a spin.
>
> XFS or other fs can use page_frag_alloc() directly, seems not necessary to
> introduce this change in block layer any more given 512-aligned buffer
> should be fine everywhere.
>
> The only benefit to make it as block helper is that the offset or size
> can be checked with q->dma_alignment.
>
> Dave/Jens, do you think which way is better? Put allocation as block
> helper or fs uses page_frag_alloc() directly for allocating 512*N-byte
> buffer(total size is less than PAGE_SIZE)?
Cristoph has already said he's looking at using page_frag_alloc()
directly in XFS....
Cheers,
Dave.
--
Dave Chinner
david@fromorbit.com
next prev parent reply other threads:[~2018-10-19 5:43 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-18 13:18 [PATCH 0/5] block: introduce helpers for allocating io buffer from slab Ming Lei
2018-10-18 13:18 ` [PATCH 1/5] block: warn on un-aligned DMA IO buffer Ming Lei
2018-10-18 14:27 ` Jens Axboe
2018-10-18 14:43 ` Christoph Hellwig
2018-10-18 14:46 ` Jens Axboe
2018-10-19 1:28 ` Ming Lei
2018-10-19 1:33 ` Jens Axboe
2018-10-19 1:39 ` Ming Lei
2018-10-19 1:52 ` Jens Axboe
2018-10-19 2:06 ` Ming Lei
2018-10-19 2:10 ` Jens Axboe
2018-10-18 14:28 ` Christoph Hellwig
2018-10-18 13:18 ` [PATCH 2/5] block: move .dma_alignment into q->limits Ming Lei
2018-10-18 14:29 ` Christoph Hellwig
2018-10-18 20:36 ` Bart Van Assche
2018-10-18 13:18 ` [PATCH 3/5] block: make dma_alignment as stacked limit Ming Lei
2018-10-18 14:31 ` Christoph Hellwig
2018-10-18 13:18 ` [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab Ming Lei
2018-10-18 14:42 ` Christoph Hellwig
2018-10-18 15:11 ` Matthew Wilcox
2018-10-18 15:22 ` Christoph Hellwig
2018-10-19 2:53 ` Ming Lei
2018-10-19 4:06 ` Jens Axboe
2018-10-19 5:43 ` Dave Chinner [this message]
2018-10-18 13:18 ` [PATCH 5/5] xfs: use block layer helpers to allocate io buffer " Ming Lei
2018-10-18 14:03 ` [PATCH 0/5] block: introduce helpers for allocating " Matthew Wilcox
2018-10-18 14:05 ` Christoph Hellwig
2018-10-18 15:06 ` Matthew Wilcox
2018-10-18 15:21 ` Christoph Hellwig
2018-10-18 15:50 ` Bart Van Assche
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=20181019054319.GL6311@dastard \
--to=david@fromorbit.com \
--cc=axboe@kernel.dk \
--cc=bvanassche@acm.org \
--cc=darrick.wong@oracle.com \
--cc=dchinner@redhat.com \
--cc=hch@lst.de \
--cc=linux-block@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=ming.lei@redhat.com \
--cc=vkuznets@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.