RE: Patch added to scsi-rc-fixes-2.6: [SCSI] arcmsr: fix message allocation

nickcheng
2008-02-25T10:48:04Z

Sorry, maybe I did not ask distinctly enough.
I mean if I would like to allocate a memory space from ZONE_DMA for atomic
context, why can I not use kmalloc(1032, GFP_ATOMIC|GFP_DMA)?
In case of lack of GFP_DMA, kmalloc would grab the memory from ZONE_HIGH or
ZONE_HIGHMEM, isn't it?(I read it from the textbook of Linux Kernel
Development by Robert Love)
Or the basic is that you don't think it is necessary to allocate a memory
space from DMA area?
Please give me some comments.
Thank you very much, :-）

-----Original Message-----
From: Daniel Drake [mailto:dsd@gentoo.org]
Sent: Monday, February 25, 2008 6:15 PM
To: nick.cheng@areca.com.tw
Cc: 'James Bottomley'; linux-scsi@vger.kernel.org
Subject: Re: Patch added to scsi-rc-fixes-2.6: [SCSI] arcmsr: fix message
allocation

nickcheng wrote:
> Hi,
> I definitely agree it is in atomic context but why is the memory not for
> DMA?
> Would you please show me why?

It would probably be easier if you could explain where you believe the
memory IS used for DMA :)

Anyway, looking at ARCMSR_MESSAGE_READ_RQBUFFER
current code does this:
ver_addr = kmalloc(1032, GFP_ATOMIC);

Here are the cases when that buffer is used:

checking for successful malloc: not DMA
if (!ver_addr) {

copying the address: not DMA
ptmpQbuffer = ver_addr;

memcpying 1 byte into the buffer: not DMA
memcpy(ptmpQbuffer, pQbuffer, 1);

incrementing address: not DMA
ptmpQbuffer++;

memcpying from the buffer: not DMA
memcpy(pcmdmessagefld->messagedatabuffer, ver_addr,
allxfer_len);

freeing the buffer: not DMA
kfree(ver_addr);

Daniel

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