Re: [PATCH] [9/20] Add blk_kmalloc/blk_alloc_pages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Mar 13 2008, James Bottomley wrote:
> \On Fri, 2008-03-07 at 18:54 +0100, Andi Kleen wrote:
> > When a user is doing IO in the kernel and wants to avoid bouncing
> > it is best to just ask the block layer to allocate the memory for it.
> > This patch adds two simple wrappers: blk_kmalloc and blk_alloc_pages
> > and respective free functions to do this.
> > 
> > blk_alloc_pages is a little unusual in that it takes size
> > instead of order arguments -- i did this because I have later
> > patches to convert it over to a new allocator which does not 
> > require power of two for pages.
> 
> I really don't like this ... it's wedging something in the block layer
> that shouldn't be there just to avoid doing it properly in terms of
> allocations on the device dma_mask.
> 
> I also think the kfree takes a length part is asking for trouble because
> it's pretty fragile.
> 
> However, if Jens will ack it, I'll (reluctantly) add it.

I agree with you, I don't like it at all (for a variety of reasons).
Since callers need to remember size for free anyway (I've always hated
such interfaces), they may as well do their own allocations. I don't
think the block abstraction buys us anything.

If anything, add a generic allocator helper that you can pass a mask to
instead.

-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux