linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Why does ion_cma_allocate need GFP_HIGHUSER | __GFP_ZERO flags?
@ 2014-11-13  7:18 Gioh Kim
  2014-11-14  1:24 ` Laura Abbott
  0 siblings, 1 reply; 3+ messages in thread
From: Gioh Kim @ 2014-11-13  7:18 UTC (permalink / raw)
  To: Colin Cross, Joonsoo Kim
  Cc: John Stultz, Greg Kroah-Hartman, lauraa, devel, linux-kernel,
	"이건호/책임연구원/SW Platform(연)AOT팀(gunho.lee@lge.com)"

Hi,

I'm wondering why dma_alloc_coherent needs GFP_HIGHUSER | __GFP_ZERO flags in ion_cma_allocate().

I think dma_alloc_coherent can go to __dma_alloc if the system has CMA area.
If __GFP_WAIT flag is set, it allocates memory from atomic pool.
So I think calling dma_alloc_coherent with __GFP_WAIT is enough.

And can I get zero-filled-memory from CMA if I set __GFP_ZERO?


-- 
Thanks,
Gioh Kim

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does ion_cma_allocate need GFP_HIGHUSER | __GFP_ZERO flags?
  2014-11-13  7:18 Why does ion_cma_allocate need GFP_HIGHUSER | __GFP_ZERO flags? Gioh Kim
@ 2014-11-14  1:24 ` Laura Abbott
  2014-11-14  1:38   ` Gioh Kim
  0 siblings, 1 reply; 3+ messages in thread
From: Laura Abbott @ 2014-11-14  1:24 UTC (permalink / raw)
  To: Gioh Kim, Colin Cross, Joonsoo Kim
  Cc: John Stultz, Greg Kroah-Hartman, devel, linux-kernel,
	"이건호/책임연구원/SW Platform(연)AOT팀(gunho.lee@lge.com)"

On 11/12/2014 11:18 PM, Gioh Kim wrote:
> Hi,
> 
> I'm wondering why dma_alloc_coherent needs GFP_HIGHUSER | __GFP_ZERO flags in ion_cma_allocate().
> 
> I think dma_alloc_coherent can go to __dma_alloc if the system has CMA area.
> If __GFP_WAIT flag is set, it allocates memory from atomic pool.
> So I think calling dma_alloc_coherent with __GFP_WAIT is enough.
> 
> And can I get zero-filled-memory from CMA if I set __GFP_ZERO?
> 
> 

If we are actually using CMA, the GFP flags don't make much of a difference. If
we didn't have CMA, using GFP_HIGHUSER would still be appropriate. The memory
is going to userspace so the user part is necessary and there should be no need
for a lowmem mapping so highmem can be used. __GFP_ZERO might be redundant since
the dma layer zeros memory anyway but it's probably safe.

I think the flags should be fine as is.

Thanks,
Laura

-- 
Qualcomm Innovation Center, Inc. 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Why does ion_cma_allocate need GFP_HIGHUSER | __GFP_ZERO flags?
  2014-11-14  1:24 ` Laura Abbott
@ 2014-11-14  1:38   ` Gioh Kim
  0 siblings, 0 replies; 3+ messages in thread
From: Gioh Kim @ 2014-11-14  1:38 UTC (permalink / raw)
  To: Laura Abbott, Colin Cross, Joonsoo Kim
  Cc: John Stultz, Greg Kroah-Hartman, devel, linux-kernel,
	"이건호/책임연구원/SW Platform(연)AOT팀(gunho.lee@lge.com)"



2014-11-14 오전 10:24에 Laura Abbott 이(가) 쓴 글:
> On 11/12/2014 11:18 PM, Gioh Kim wrote:
>> Hi,
>>
>> I'm wondering why dma_alloc_coherent needs GFP_HIGHUSER | __GFP_ZERO flags in ion_cma_allocate().
>>
>> I think dma_alloc_coherent can go to __dma_alloc if the system has CMA area.
>> If __GFP_WAIT flag is set, it allocates memory from atomic pool.
>> So I think calling dma_alloc_coherent with __GFP_WAIT is enough.
>>
>> And can I get zero-filled-memory from CMA if I set __GFP_ZERO?
>>
>>
> 
> If we are actually using CMA, the GFP flags don't make much of a difference. If
> we didn't have CMA, using GFP_HIGHUSER would still be appropriate. The memory
> is going to userspace so the user part is necessary and there should be no need
> for a lowmem mapping so highmem can be used. __GFP_ZERO might be redundant since
> the dma layer zeros memory anyway but it's probably safe.

If cma-heap can be created even-if the system doesn't have CMA area, you're right.

But I think cma-heap should be created only if the system has CMA area.
I think, in no CMA system, cma-heap creation and/or allocation from cma-heap should be failed,
not allocate memory from lowmem or highmem as you say.

Thanks for your reply.

> 
> I think the flags should be fine as is.
> 
> Thanks,
> Laura
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-11-14  1:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-13  7:18 Why does ion_cma_allocate need GFP_HIGHUSER | __GFP_ZERO flags? Gioh Kim
2014-11-14  1:24 ` Laura Abbott
2014-11-14  1:38   ` Gioh Kim

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).