Hi,

I noticed some allocation failure using kmalloc in case of GFP_DMA32 with big 
size, even if I modified the CONFIG_FORCE_MAX_ZONEORDER to be coherent with my 
max size (32MB).
I don't know the reason of this failure. I am interesting by any idea about 
this point ...
Meanwhile, to avoid this trouble I performed the following additional patch in 
ksrc/nucleus/heap.c to force using of __get_free_pages instead of kmalloc in 
case of GFP_DMA32 flag.
Jacques

*** ../../../xenomai-2.5.4_old/ksrc/nucleus/heap.c      2010-10-13 
17:10:27.000000000 +0200
--- heap.c      2010-10-19 09:22:13.000000000 +0200
*************** static inline void *__alloc_and_reserve_
*** 1033,1039 ****
                 * Otherwise, we have been asked for some kmalloc()
                 * space. Assume that we can wait to get the required memory.
                 */
!               if (size <= KMALLOC_MAX_SIZE)
                        ptr = kmalloc(size, kmflags | GFP_KERNEL);
                else
                        ptr = (void *)__get_free_pages(kmflags | GFP_KERNEL,
--- 1033,1039 ----
                 * Otherwise, we have been asked for some kmalloc()
                 * space. Assume that we can wait to get the required memory.
                 */
!               if (!(kmflags & GFP_DMA32) && (size <= KMALLOC_MAX_SIZE))
                        ptr = kmalloc(size, kmflags | GFP_KERNEL);
                else
                        ptr = (void *)__get_free_pages(kmflags | GFP_KERNEL,
*************** static void __unreserve_and_free_heap(vo
*** 1066,1072 ****
                for (vaddr = vabase; vaddr < vabase + size; vaddr += PAGE_SIZE)
                        ClearPageReserved(virt_to_page(vaddr));
  
!               if (size <= KMALLOC_MAX_SIZE)
                        kfree(ptr);
                else
                        free_pages((unsigned long)ptr, get_order(size));
--- 1066,1072 ----
                for (vaddr = vabase; vaddr < vabase + size; vaddr += PAGE_SIZE)
                        ClearPageReserved(virt_to_page(vaddr));
  
!               if (!(kmflags & GFP_DMA32) && (size <= KMALLOC_MAX_SIZE))
                        kfree(ptr);
                else
                        free_pages((unsigned long)ptr, get_order(size));

-----Original Message-----
From: Gilles Chanteperdrix [mailto:[email protected]] 
Sent: vendredi 15 octobre 2010 00:30
To: Daniel Jacques (Alten)
Cc: [email protected]
Subject: Re: [Xenomai-help] rt_heap and DMA32 zone

Daniel Jacques (Alten) wrote:
> Yes, it seems to be the solution.
> I performed the following patch and the problem is solved on my application

Applied, thanks.

-- 
                                                                Gilles.
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to