linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* dma_alloc_coherent fragmentation
@ 2009-03-18 13:03 Kamat, Nishant
  2009-03-18 19:24 ` Russell King - ARM Linux
  2009-03-19  6:42 ` Hiroshi DOYU
  0 siblings, 2 replies; 13+ messages in thread
From: Kamat, Nishant @ 2009-03-18 13:03 UTC (permalink / raw)
  To: linux-arm-kernel, Menon, Nishanth
  Cc: linux-omap, Ramirez Luna, Omar, Kanigeri, Hari, Guzman Lugo,
	Fernando, Kevin Hilman, 2ameya

Forwarding on behalf of Nishanth Menon:

-----Original Message-----
From: Menon, Nishanth 
Sent: Tuesday, March 17, 2009 8:17 AM
To: 'linux-arm-kernel@lists.arm.linux.org.uk'
Cc: Gupta, Ramesh; Kevin Hilman; linux-omap@vger.kernel.org; Ramirez Luna, Omar; Kanigeri, Hari; Ameya Palande; Guzman Lugo, Fernando; Ameya Palande
Subject: dma_alloc_coherent fragmentation

Looping in linux-arm ML:

Discussion Ref: [1](linux-omap mailing list)
While working with Linux OMAP kernel[2] we found that on allocating 4 meg chunks using dma_alloc_coherent and de-allocating with dma_free_coherent in a loop using a test driver[7], the memory is getting fragmented as shown by Ameya's observation [3] finally resulting in dump_stack due to lack of pages.

Searching through previous archives, found [4] which seem to imply that allocating chunks greater than 1 page could cause fragmentation.

I wonder why we see this even if we allocate and free the memory in sequence as in [5]. This seems to happen on 2.6.28 and 2.6.29 but not on the 2.6.27 based kernel[6].

Regards,
Nishanth Menon

Ref:
[1] http://marc.info/?t=123719779100002&r=1&w=2
[2] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git
[3] http://marc.info/?l=linux-omap&m=123722460022336&w=2
[4] http://lkml.indiana.edu/hypermail/linux/kernel/0706.0/0370.html 
[5] http://marc.info/?l=linux-omap&m=123719772811746&w=2
[6] http://git.omapzoom.com/?p=repo/omapkernel.git;
[7] http://marc.info/?l=linux-omap&m=123719772811746&q=p3 

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

* Re: dma_alloc_coherent fragmentation
  2009-03-18 13:03 dma_alloc_coherent fragmentation Kamat, Nishant
@ 2009-03-18 19:24 ` Russell King - ARM Linux
  2009-03-18 20:08   ` Menon, Nishanth
  2009-03-19  6:42 ` Hiroshi DOYU
  1 sibling, 1 reply; 13+ messages in thread
From: Russell King - ARM Linux @ 2009-03-18 19:24 UTC (permalink / raw)
  To: Kamat, Nishant
  Cc: linux-arm-kernel, Menon, Nishanth, linux-omap, Ramirez Luna,
	Omar, Kanigeri, Hari, Guzman Lugo, Fernando, Kevin Hilman,
	2ameya

On Wed, Mar 18, 2009 at 08:03:45AM -0500, Kamat, Nishant wrote:
> Forwarding on behalf of Nishanth Menon:

Make sure you're up to date with fixes to the ioremap code, specifically
24f11ec001920f1cfaeeed8e8b55725d900bbb56.  This is not in 2.6.28,
2.6.29-rc1, 2.6.29-rc2, but is in -rc3 and later.  2.6.29 itself hasn't
been released yet so I don't know what "seems to happen on 2.6.28 and
2.6.29" actually means because its nonsense.

So, please test with 2.6.29-rc3 or later.

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

* RE: dma_alloc_coherent fragmentation
  2009-03-18 19:24 ` Russell King - ARM Linux
@ 2009-03-18 20:08   ` Menon, Nishanth
  0 siblings, 0 replies; 13+ messages in thread
From: Menon, Nishanth @ 2009-03-18 20:08 UTC (permalink / raw)
  To: Russell King - ARM Linux, Kamat, Nishant
  Cc: linux-arm-kernel, linux-omap, Ramirez Luna, Omar, Kanigeri, Hari,
	Guzman Lugo, Fernando, Kevin Hilman, 2ameya

> -----Original Message-----
> From: Russell King - ARM Linux [mailto:linux@arm.linux.org.uk]
> Sent: Wednesday, March 18, 2009 9:25 PM
> To: Kamat, Nishant
> Cc: linux-arm-kernel@lists.arm.linux.org.uk; Menon, Nishanth; linux-
> omap@vger.kernel.org; Ramirez Luna, Omar; Kanigeri, Hari; Guzman Lugo,
> Fernando; Kevin Hilman; 2ameya@gmail.com
> Subject: Re: dma_alloc_coherent fragmentation

> Make sure you're up to date with fixes to the ioremap code, specifically
> 24f11ec001920f1cfaeeed8e8b55725d900bbb56.  This is not in 2.6.28,
> 2.6.29-rc1, 2.6.29-rc2, but is in -rc3 and later.  2.6.29 itself hasn't
> been released yet so I don't know what "seems to happen on 2.6.28 and
> 2.6.29" actually means because its nonsense.

Apologies on the confusion.

For this issue, the pertinent tree would be the master branch of [1] linux-omap tree which is synced to 2.6.29-rc8. And yes, the mentioned commit ID is part of the git log.

Relevant test code and report of the crash is in [2]. Additional observation in [3]

Regards,
Nishanth Menon

Ref:
[1] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git
[2] http://marc.info/?l=linux-omap&m=123719772811746&w=2
[3] http://marc.info/?l=linux-omap&m=123722460022336&w=2

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

* Re: dma_alloc_coherent fragmentation
  2009-03-18 13:03 dma_alloc_coherent fragmentation Kamat, Nishant
  2009-03-18 19:24 ` Russell King - ARM Linux
@ 2009-03-19  6:42 ` Hiroshi DOYU
  2009-03-19  9:06   ` Menon, Nishanth
  1 sibling, 1 reply; 13+ messages in thread
From: Hiroshi DOYU @ 2009-03-19  6:42 UTC (permalink / raw)
  To: nm
  Cc: linux-arm-kernel, nskamat, linux-omap, x00omar, h-kanigeri2,
	x0095840, khilman, 2ameya

Hi Nishant,

From: "ext Kamat, Nishant" <nskamat@ti.com>
Subject: dma_alloc_coherent fragmentation
Date: Wed, 18 Mar 2009 14:03:45 +0100

> Forwarding on behalf of Nishanth Menon:
> 
> -----Original Message-----
> From: Menon, Nishanth 
> Sent: Tuesday, March 17, 2009 8:17 AM
> To: 'linux-arm-kernel@lists.arm.linux.org.uk'
> Cc: Gupta, Ramesh; Kevin Hilman; linux-omap@vger.kernel.org; Ramirez Luna, Omar; Kanigeri, Hari; Ameya Palande; Guzman Lugo, Fernando; Ameya Palande
> Subject: dma_alloc_coherent fragmentation
> 
> Looping in linux-arm ML:
> 
> Discussion Ref: [1](linux-omap mailing list)
> While working with Linux OMAP kernel[2] we found that on allocating
> 4 meg chunks using dma_alloc_coherent and de-allocating with
> dma_free_coherent in a loop using a test driver[7], the memory is
> getting fragmented as shown by Ameya's observation [3] finally
> resulting in dump_stack due to lack of pages.

What would happen with __GFP_RECLAIMABLE for dma_alloc_coherent()?

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

* RE: dma_alloc_coherent fragmentation
  2009-03-19  6:42 ` Hiroshi DOYU
@ 2009-03-19  9:06   ` Menon, Nishanth
  2009-04-22  7:46     ` pramod gurav
  0 siblings, 1 reply; 13+ messages in thread
From: Menon, Nishanth @ 2009-03-19  9:06 UTC (permalink / raw)
  To: Hiroshi DOYU
  Cc: linux-arm-kernel, Kamat, Nishant, linux-omap, Ramirez Luna, Omar,
	Kanigeri, Hari, Guzman Lugo, Fernando, khilman, 2ameya

Hi Hiroshi,
> -----Original Message-----
> From: Hiroshi DOYU [mailto:Hiroshi.DOYU@nokia.com]
> Sent: Thursday, March 19, 2009 8:43 AM

> 
> 
> What would happen with __GFP_RECLAIMABLE for dma_alloc_coherent()?
As per [1], GFP_TEMPORARY might be the right approach.. but yes,
Changing dummy to do:
dma_alloc_coherent(NULL, b[i].size, &b[i].phy, GFP_TEMPORARY);

Seems to resolve the issue with the dummy driver.

The question however still remains: For a driver to allocate a memory which is not temporary in nature we'd recommend GFP_KERNEL. But as part of the exit sequence the driver will deallocate that memory and as part of init sequence, reallocate. Given that the memory is not reclaimed immediately, it looks like the only way to ensure that would be to do GFP_KERNEL | __GFP_RECLAIMABLE (which essentially is the definition of GFP_TEMPORARY).

Regards,
Nishanth Menon
Ref:
[1] http://lkml.indiana.edu/hypermail/linux/kernel/0705.2/0638.html

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

* Re: dma_alloc_coherent fragmentation
  2009-03-19  9:06   ` Menon, Nishanth
@ 2009-04-22  7:46     ` pramod gurav
  2009-04-22  7:50       ` Shilimkar, Santosh
  2009-04-22  9:14       ` Gupta, Ramesh
  0 siblings, 2 replies; 13+ messages in thread
From: pramod gurav @ 2009-04-22  7:46 UTC (permalink / raw)
  To: Menon, Nishanth; +Cc: linux-omap

Hi Nishant,
I am facing the same problem to allocate a chunk of 4MB on omap3evm
using dma_alloc_coherent. I used the test driver mentioned here
http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html

I applied the patch for
ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
Russell, but stiill seeing the error saying

coherent allocation too big (requested 0x400000 mask 0xffffffff)
alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
Allocation failed idx=0
insmod: cannot insert `dummy.ko': Cannot allocate memory (-1): Cannot
allocate memory

I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
__GFP_RECLAIMABLE), but failed to insmod the module.
I am working on linux-omap 2.6.28 kernel. Even I could not allocate
memory size greater than 1MB.
Has this been fixed? Are there any patches to fix this issue?

On Thu, Mar 19, 2009 at 2:36 PM, Menon, Nishanth <nm@ti.com> wrote:
> Hi Hiroshi,
>> -----Original Message-----
>> From: Hiroshi DOYU [mailto:Hiroshi.DOYU@nokia.com]
>> Sent: Thursday, March 19, 2009 8:43 AM
>
>>
>>
>> What would happen with __GFP_RECLAIMABLE for dma_alloc_coherent()?
> As per [1], GFP_TEMPORARY might be the right approach.. but yes,
> Changing dummy to do:
> dma_alloc_coherent(NULL, b[i].size, &b[i].phy, GFP_TEMPORARY);
>
> Seems to resolve the issue with the dummy driver.
>
> The question however still remains: For a driver to allocate a memory which is not temporary in nature we'd recommend GFP_KERNEL. But as part of the exit sequence the driver will deallocate that memory and as part of init sequence, reallocate. Given that the memory is not reclaimed immediately, it looks like the only way to ensure that would be to do GFP_KERNEL | __GFP_RECLAIMABLE (which essentially is the definition of GFP_TEMPORARY).
>
> Regards,
> Nishanth Menon
> Ref:
> [1] http://lkml.indiana.edu/hypermail/linux/kernel/0705.2/0638.html
> --
> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>



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

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

* RE: dma_alloc_coherent fragmentation
  2009-04-22  7:46     ` pramod gurav
@ 2009-04-22  7:50       ` Shilimkar, Santosh
  2009-04-22  8:23         ` pramod gurav
  2009-04-22  9:14       ` Gupta, Ramesh
  1 sibling, 1 reply; 13+ messages in thread
From: Shilimkar, Santosh @ 2009-04-22  7:50 UTC (permalink / raw)
  To: pramod gurav, Menon, Nishanth; +Cc: linux-omap

DMA pool is better solution for such usecases.
> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
> Sent: Wednesday, April 22, 2009 1:17 PM
> To: Menon, Nishanth
> Cc: linux-omap@vger.kernel.org
> Subject: Re: dma_alloc_coherent fragmentation
> 
> Hi Nishant,
> I am facing the same problem to allocate a chunk of 4MB on omap3evm
> using dma_alloc_coherent. I used the test driver mentioned here
> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html
> 
> I applied the patch for
> ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
> Russell, but stiill seeing the error saying
> 
> coherent allocation too big (requested 0x400000 mask 0xffffffff)
> alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
> Allocation failed idx=0
> insmod: cannot insert `dummy.ko': Cannot allocate memory (-1): Cannot
> allocate memory
> 
> I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
> __GFP_RECLAIMABLE), but failed to insmod the module.
> I am working on linux-omap 2.6.28 kernel. Even I could not allocate
> memory size greater than 1MB.
> Has this been fixed? Are there any patches to fix this issue?
> 
> On Thu, Mar 19, 2009 at 2:36 PM, Menon, Nishanth <nm@ti.com> wrote:

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

* Re: dma_alloc_coherent fragmentation
  2009-04-22  7:50       ` Shilimkar, Santosh
@ 2009-04-22  8:23         ` pramod gurav
  2009-04-22  8:51           ` Shilimkar, Santosh
  0 siblings, 1 reply; 13+ messages in thread
From: pramod gurav @ 2009-04-22  8:23 UTC (permalink / raw)
  To: Shilimkar, Santosh; +Cc: Menon, Nishanth, linux-omap

Thanks for the quick reply.
Can you please point me to some links on DMA pools. I am just blank on this. :(
I will still search for this in net.
-- 
Best Regards
Pramod

On Wed, Apr 22, 2009 at 1:20 PM, Shilimkar, Santosh
<santosh.shilimkar@ti.com> wrote:
> DMA pool is better solution for such usecases.
>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org
>> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
>> Sent: Wednesday, April 22, 2009 1:17 PM
>> To: Menon, Nishanth
>> Cc: linux-omap@vger.kernel.org
>> Subject: Re: dma_alloc_coherent fragmentation
>>
>> Hi Nishant,
>> I am facing the same problem to allocate a chunk of 4MB on omap3evm
>> using dma_alloc_coherent. I used the test driver mentioned here
>> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html
>>
>> I applied the patch for
>> ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
>> Russell, but stiill seeing the error saying
>>
>> coherent allocation too big (requested 0x400000 mask 0xffffffff)
>> alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
>> Allocation failed idx=0
>> insmod: cannot insert `dummy.ko': Cannot allocate memory (-1): Cannot
>> allocate memory
>>
>> I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
>> __GFP_RECLAIMABLE), but failed to insmod the module.
>> I am working on linux-omap 2.6.28 kernel. Even I could not allocate
>> memory size greater than 1MB.
>> Has this been fixed? Are there any patches to fix this issue?
>>
>> On Thu, Mar 19, 2009 at 2:36 PM, Menon, Nishanth <nm@ti.com> wrote:
>

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

* RE: dma_alloc_coherent fragmentation
  2009-04-22  8:23         ` pramod gurav
@ 2009-04-22  8:51           ` Shilimkar, Santosh
  0 siblings, 0 replies; 13+ messages in thread
From: Shilimkar, Santosh @ 2009-04-22  8:51 UTC (permalink / raw)
  To: pramod gurav; +Cc: Menon, Nishanth, linux-omap

The actual apis are in mm/dmapool.c. There are quite a few users in the usb stack.

Here are few examples.

Amd5536udc.c (drivers\usb\gadget):	
Buffer.c (drivers\usb\core):
Ci13xxx_udc.c (drivers\usb\gadget)
Ci13xxx_udc.c (drivers\usb\gadget)
Cppi_dma.c (drivers\usb\musb):	
Ehci-mem.c (drivers\usb\host):
Ehci-mem.c (drivers\usb\host):
Ehci-mem.c (drivers\usb\host):
Ehci-mem.c (drivers\usb\host):
Ixp4xx_crypto.c (drivers\crypto):	
Ixp4xx_crypto.c (drivers\crypto):	
Ohci-mem.c (drivers\usb\host):
Ohci-mem.c (drivers\usb\host):
Uhci-hcd.c (drivers\usb\host):
Uhci-hcd.c (drivers\usb\host):

Regards,
Santosh
 

> -----Original Message-----
> From: pramod gurav [mailto:pramodforum@gmail.com] 
> Sent: Wednesday, April 22, 2009 1:54 PM
> To: Shilimkar, Santosh
> Cc: Menon, Nishanth; linux-omap@vger.kernel.org
> Subject: Re: dma_alloc_coherent fragmentation
> 
> Thanks for the quick reply.
> Can you please point me to some links on DMA pools. I am just 
> blank on this. :(
> I will still search for this in net.
> -- 

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

* RE: dma_alloc_coherent fragmentation
  2009-04-22  7:46     ` pramod gurav
  2009-04-22  7:50       ` Shilimkar, Santosh
@ 2009-04-22  9:14       ` Gupta, Ramesh
  2009-04-22  9:44         ` pramod gurav
  1 sibling, 1 reply; 13+ messages in thread
From: Gupta, Ramesh @ 2009-04-22  9:14 UTC (permalink / raw)
  To: pramod gurav, Menon, Nishanth; +Cc: linux-omap

Hi Pramod,
 

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
> Sent: Wednesday, April 22, 2009 1:17 PM
> To: Menon, Nishanth
> Cc: linux-omap@vger.kernel.org
> Subject: Re: dma_alloc_coherent fragmentation
> 
> Hi Nishant,
> I am facing the same problem to allocate a chunk of 4MB on omap3evm
> using dma_alloc_coherent. I used the test driver mentioned here
> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html
> 
> I applied the patch for
> ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
> Russell, but stiill seeing the error saying
> 
> coherent allocation too big (requested 0x400000 mask 0xffffffff)
> alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
> Allocation failed idx=0
> insmod: cannot insert `dummy.ko': Cannot allocate memory (-1): Cannot
> allocate memory
> 
> I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
> __GFP_RECLAIMABLE), but failed to insmod the module.
> I am working on linux-omap 2.6.28 kernel. Even I could not allocate
> memory size greater than 1MB.
> Has this been fixed? Are there any patches to fix this issue?
> 

What is the value for 'CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE' (default is 2 in omap_3430sdp_defconfig), Can you please
try increasing to 8?

Regards
Ramesh Gupta G

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

* Re: dma_alloc_coherent fragmentation
  2009-04-22  9:14       ` Gupta, Ramesh
@ 2009-04-22  9:44         ` pramod gurav
  2009-04-22 10:09           ` Shilimkar, Santosh
  0 siblings, 1 reply; 13+ messages in thread
From: pramod gurav @ 2009-04-22  9:44 UTC (permalink / raw)
  To: Gupta, Ramesh; +Cc: Menon, Nishanth, linux-omap

Hi Ramesh,
This worked. Thanks a lot.


-- 
Best Regards
Pramod


On Wed, Apr 22, 2009 at 2:44 PM, Gupta, Ramesh <grgupta@ti.com> wrote:
> Hi Pramod,
>
>
>> -----Original Message-----
>> From: linux-omap-owner@vger.kernel.org
>> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
>> Sent: Wednesday, April 22, 2009 1:17 PM
>> To: Menon, Nishanth
>> Cc: linux-omap@vger.kernel.org
>> Subject: Re: dma_alloc_coherent fragmentation
>>
>> Hi Nishant,
>> I am facing the same problem to allocate a chunk of 4MB on omap3evm
>> using dma_alloc_coherent. I used the test driver mentioned here
>> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html
>>
>> I applied the patch for
>> ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
>> Russell, but stiill seeing the error saying
>>
>> coherent allocation too big (requested 0x400000 mask 0xffffffff)
>> alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
>> Allocation failed idx=0
>> insmod: cannot insert `dummy.ko': Cannot allocate memory (-1): Cannot
>> allocate memory
>>
>> I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
>> __GFP_RECLAIMABLE), but failed to insmod the module.
>> I am working on linux-omap 2.6.28 kernel. Even I could not allocate
>> memory size greater than 1MB.
>> Has this been fixed? Are there any patches to fix this issue?
>>
>
> What is the value for 'CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE' (default is 2 in omap_3430sdp_defconfig), Can you please
> try increasing to 8?
>
> Regards
> Ramesh Gupta G
>

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

* RE: dma_alloc_coherent fragmentation
  2009-04-22  9:44         ` pramod gurav
@ 2009-04-22 10:09           ` Shilimkar, Santosh
  0 siblings, 0 replies; 13+ messages in thread
From: Shilimkar, Santosh @ 2009-04-22 10:09 UTC (permalink / raw)
  To: pramod gurav, Gupta, Ramesh; +Cc: Menon, Nishanth, linux-omap

This would just temporarily delay the problem. People have even tried with values of 14 MB and all. Nishant M knows one such recent issue.

Bye the way use of this macro for general DMAable memory is discouraged. You can find many threads on ARM mailing list. 

Regards,
Santosh
 

> -----Original Message-----
> From: linux-omap-owner@vger.kernel.org 
> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
> Sent: Wednesday, April 22, 2009 3:14 PM
> To: Gupta, Ramesh
> Cc: Menon, Nishanth; linux-omap@vger.kernel.org
> Subject: Re: dma_alloc_coherent fragmentation
> 
> Hi Ramesh,
> This worked. Thanks a lot.
> 
> 
> -- 
> Best Regards
> Pramod
> 
> 
> On Wed, Apr 22, 2009 at 2:44 PM, Gupta, Ramesh <grgupta@ti.com> wrote:
> > Hi Pramod,
> >
> >
> >> -----Original Message-----
> >> From: linux-omap-owner@vger.kernel.org
> >> [mailto:linux-omap-owner@vger.kernel.org] On Behalf Of pramod gurav
> >> Sent: Wednesday, April 22, 2009 1:17 PM
> >> To: Menon, Nishanth
> >> Cc: linux-omap@vger.kernel.org
> >> Subject: Re: dma_alloc_coherent fragmentation
> >>
> >> Hi Nishant,
> >> I am facing the same problem to allocate a chunk of 4MB on omap3evm
> >> using dma_alloc_coherent. I used the test driver mentioned here
> >> 
> http://www.mail-archive.com/linux-omap@vger.kernel.org/msg11074.html
> >>
> >> I applied the patch for
> >> ioremap(24f11ec001920f1cfaeeed8e8b55725d900bbb56) suggested by
> >> Russell, but stiill seeing the error saying
> >>
> >> coherent allocation too big (requested 0x400000 mask 0xffffffff)
> >> alloc[0] - virt=0x00000000 phy=0xFFFFFFFF size=0x00400000
> >> Allocation failed idx=0
> >> insmod: cannot insert `dummy.ko': Cannot allocate memory 
> (-1): Cannot
> >> allocate memory
> >>
> >> I changed the GFP_KERNEL to GFP_TEMPORARY and also to (GFP_KERNEL |
> >> __GFP_RECLAIMABLE), but failed to insmod the module.
> >> I am working on linux-omap 2.6.28 kernel. Even I could not allocate
> >> memory size greater than 1MB.
> >> Has this been fixed? Are there any patches to fix this issue?
> >>
> >
> > What is the value for 'CONFIG_FB_OMAP_CONSISTENT_DMA_SIZE' 
> (default is 2 in omap_3430sdp_defconfig), Can you please
> > try increasing to 8?
> >
> > Regards
> > Ramesh Gupta G
> >
> --
> To unsubscribe from this list: send the line "unsubscribe 
> linux-omap" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 

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

* dma_alloc_coherent fragmentation
  2009-03-16 19:09       ` Menon, Nishanth
@ 2009-03-17  6:16         ` Menon, Nishanth
  0 siblings, 0 replies; 13+ messages in thread
From: Menon, Nishanth @ 2009-03-17  6:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Gupta, Ramesh, Kevin Hilman, linux-omap, Ramirez Luna, Omar,
	Kanigeri, Hari, Ameya Palande, Guzman Lugo, Fernando,
	Ameya Palande

Looping in linux-arm ML:

Discussion Ref: [1](linux-omap mailing list)
While working with Linux OMAP kernel[2] we found that on allocating 4 meg chunks using dma_alloc_coherent and de-allocating with dma_free_coherent in a loop using a test driver[7], the memory is getting fragmented as shown by Ameya's observation [3] finally resulting in dump_stack due to lack of pages.

Searching through previous archives, found [4] which seem to imply that allocating chunks greater than 1 page could cause fragmentation.

I wonder why we see this even if we allocate and free the memory in sequence as in [5]. This seems to happen on 2.6.28 and 2.6.29 but not on the 2.6.27 based kernel[6].

Regards,
Nishanth Menon

Ref:
[1] http://marc.info/?t=123719779100002&r=1&w=2
[2] http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git
[3] http://marc.info/?l=linux-omap&m=123722460022336&w=2
[4] http://lkml.indiana.edu/hypermail/linux/kernel/0706.0/0370.html 
[5] http://marc.info/?l=linux-omap&m=123719772811746&w=2
[6] http://git.omapzoom.com/?p=repo/omapkernel.git;
[7] http://marc.info/?l=linux-omap&m=123719772811746&q=p3 

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

end of thread, other threads:[~2009-04-22 10:09 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-18 13:03 dma_alloc_coherent fragmentation Kamat, Nishant
2009-03-18 19:24 ` Russell King - ARM Linux
2009-03-18 20:08   ` Menon, Nishanth
2009-03-19  6:42 ` Hiroshi DOYU
2009-03-19  9:06   ` Menon, Nishanth
2009-04-22  7:46     ` pramod gurav
2009-04-22  7:50       ` Shilimkar, Santosh
2009-04-22  8:23         ` pramod gurav
2009-04-22  8:51           ` Shilimkar, Santosh
2009-04-22  9:14       ` Gupta, Ramesh
2009-04-22  9:44         ` pramod gurav
2009-04-22 10:09           ` Shilimkar, Santosh
  -- strict thread matches above, loose matches on Subject: below --
2009-03-13 15:59 Bridge issue #3! dma_alloc_coherent causing crash - pm branch Kevin Hilman
2009-03-14  4:26 ` Gupta, Ramesh
2009-03-16  9:54   ` dma_alloc_coherent bug? Menon, Nishanth
2009-03-16 17:29     ` Ameya Palande
2009-03-16 19:09       ` Menon, Nishanth
2009-03-17  6:16         ` dma_alloc_coherent fragmentation Menon, Nishanth

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).