Hi.<br><br>We have faced with WQXGA(2560x1600) support and framebuffers become dramatically larger.<br>Moreover, high resolution camera sensors also press memory use more than the screen size.<br><br>However, I think that it is enough with your change because allocation failure of several<br>
contiguous pages also shows that the system don't have enough memory.<br><br>On Wed, Aug 22, 2012 at 10:36 PM, Hiroshi Doyu <<a href="mailto:hdoyu@nvidia.com">hdoyu@nvidia.com</a>> wrote:<br>> Hi,<br>><br>
> KyongHo Cho <<a href="mailto:pullip.cho@samsung.com">pullip.cho@samsung.com</a>> wrote @ Wed, 22 Aug 2012 14:47:00 +0200:<br>><br>>> vzalloc() call in __iommu_alloc_buffer() also causes BUG() in atomic context.<br>
><br>> Right.<br>><br>> I've been thinking that kzalloc() may be enough here, since<br>> vzalloc() was introduced to avoid allocation failure for big chunk of<br>> memory, but I think that it's unlikely that the number of page array<br>
> can be so big. So I propose to drop vzalloc() here, and just simply to<br>> use kzalloc only as below(*1).<br>><br>> For example,<br>><br>> 1920(H) x 1080(W) x 4(bytes) ~= 8MiB<br>><br>> For 8 MiB buffer,<br>
>   8(MiB) * 1024 = 8192(KiB)<br>>   8192(KiB) / 4(KiB/page) = 2048 pages<br>>   sizeof(struct page *) = 4 bytes<br>>   2048(pages) * 4(bytes/page) = 8192(bytes) = 8(KiB)<br>>   8(KiB) / 4(KiB/page) = 2 pages<br>
><br>> If the above estimation is right(I hope;)), the necessary pages are<br>> _at most_ 2 pages. If the system gets into the situation to fail to<br>> allocate 2 contiguous pages, that's real the problem. I guess that<br>
> that kind of fragmentation problem would be solved with page migration<br>> or something, especially nowadays devices are getting larger memories.<br>><br>> *1:<br>> From a613c40d1b3d4fb1577cdb0807a74e8dbd08a3e6 Mon Sep 17 00:00:00 2001<br>
> From: Hiroshi Doyu <<a href="mailto:hdoyu@nvidia.com">hdoyu@nvidia.com</a>><br>> Date: Wed, 22 Aug 2012 16:25:54 +0300<br>> Subject: [PATCH 1/1] ARM: dma-mapping: Use only kzalloc without vzalloc<br>><br>
> Use only kzalloc for atomic allocation.<br>><br>> Signed-off-by: Hiroshi Doyu <<a href="mailto:hdoyu@nvidia.com">hdoyu@nvidia.com</a>><br>> ---<br>>  arch/arm/mm/dma-mapping.c |   10 ++--------<br>>  1 files changed, 2 insertions(+), 8 deletions(-)<br>
><br>> diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c<br>> index 4656c0f..d4f1cf2 100644<br>> --- a/arch/arm/mm/dma-mapping.c<br>> +++ b/arch/arm/mm/dma-mapping.c<br>> @@ -1083,10 +1083,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,<br>
>         int count = size >> PAGE_SHIFT;<br>>         int array_size = count * sizeof(struct page *);<br>><br>> -       if (array_size <= PAGE_SIZE)<br>> -               pages = kzalloc(array_size, gfp);<br>
> -       else<br>> -               pages = vzalloc(array_size);<br>> +       pages = kzalloc(array_size, gfp);<br>>         if (!pages)<br>>                 return NULL;<br>><br>> @@ -1107,10 +1104,7 @@ static struct page **__iommu_alloc_buffer(struct device *dev, size_t size,<br>
><br>>         return pages;<br>>  error:<br>> -       if (array_size <= PAGE_SIZE)<br>> -               kfree(pages);<br>> -       else<br>> -               vfree(pages);<br>> +       kfree(pages);<br>
>         return NULL;<br>>  }<br>><br>> --<br>> 1.7.5.4<br>><br>> --<br>> To unsubscribe, send a message with 'unsubscribe linux-mm' in<br>> the body to <a href="mailto:majordomo@kvack.org">majordomo@kvack.org</a>.  For more info on Linux MM,<br>
> see: <a href="http://www.linux-mm.org/">http://www.linux-mm.org/</a> .<br>> Don't email: <a hrefmailto:"<a href="mailto:dont@kvack.org">dont@kvack.org</a>"> <a href="mailto:email@kvack.org">email@kvack.org</a> </a><br>
<br>