[PATCH for-4.13] nvme-pci: use dma memory for the host memory buffer descriptors

Christoph Hellwig hch at lst.de
Tue Aug 29 07:50:33 PDT 2017


On Tue, Aug 29, 2017 at 03:59:23PM +0200, Johannes Thumshirn wrote:
> On Mon, Aug 28, 2017 at 10:47:18AM +0200, Christoph Hellwig wrote:
> > -	descs = kcalloc(max_entries, sizeof(*descs), GFP_KERNEL);
> > +	descs = dma_zalloc_coherent(dev->dev, max_entries * sizeof(*descs),
> > +			&descs_dma, GFP_KERNEL);
> 
> [...]
> 
> > -	kfree(descs);
> > +	dma_free_coherent(dev->dev, max_entries * sizeof(*dev->host_mem_descs),
> > +			descs, descs_dma);
> 
> If the patch isn't super urgent, I'd prefere the sizeof() arguments being
> aligned, i.e. either sizeof(*descs) _or_ sizeof(*dev->host_mem_descs) but not
> both. It's rather confusing for the reader. Maybe just cache the max_entries *
> sizeof(*dev->host_mem_descs) value?

Sure, I'll fix it up.



More information about the Linux-nvme mailing list