Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Dave Chinner
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

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Jens Axboe
On 10/18/18 8:53 PM, 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

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Ming Lei
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

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Christoph Hellwig
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

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Matthew Wilcox
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

Re: [PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Christoph Hellwig
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

[PATCH 4/5] block: introduce helpers for allocating IO buffers from slab

2018-10-18 Thread Ming Lei
One big issue is that the allocated buffer from slab has to respect the queue DMA alignment limit. This patch supports to create one kmem_cache for less-than PAGE_SIZE allocation, and makes sure that the allocation is aligned with queue DMA alignment. For >= PAGE_SIZE allocation, it should be