Re: Why does “page allocation failure” occur whereas there are still “58*4096kB (C)” could be used?

孙世龙 sunshilong sunshilong369 at gmail.com
Fri Jun 19 02:56:20 EDT 2020


>> Why does "page allocation failure" occur whereas there are still
"58*4096kB
>> (C)"(*I think it indicates there are 58 order 10 memory could be used*)
>> could be used?
>>
>> Here is the related log:
>>
>> [ 2161.623563] xxxx: page allocation failure: order:10,
>> mode:0x2084020(GFP_ATOMIC|__GFP_COMP)
>
>If you look at the source for alloc_ap_req(), you find it wants
GFP_ATOMIC, not
>CMA.  And your box is fresh out of contiguous order-10 spaces that aren't
CMA,
>and you're down to your last 3 order-9 flagged as (UEC).

Thank you for the clarification.
I understand it on a deeper level with your help.

Why doesn't the kernel use two memory blocks whose size is 2048KB(i.e.*oder
9 *)
instead of one block *order 10 *(you see, there are still three free blocks
and
 2048KB*2=4096KB equivalent to the memory size of order 10)?

>If you look at the source for alloc_ap_req(), you find it wants
GFP_ATOMIC, not
>CMA.
I followed your advice and read the related source code carefully.
It's corresponding to the log(i.e.   mode:0x2084020(GFP_ATOMIC|__GFP_COMP)
).

Thank you for your attention to this matter.
Look forward to hearing from you.
Best regards.

Valdis Klētnieks <valdis.kletnieks at vt.edu> 于2020年6月19日周五 下午12:48写道:

> On Thu, 18 Jun 2020 14:21:05 +0800, sunshiong said:
>
> > Why does "page allocation failure" occur whereas there are still
> "58*4096kB
> > (C)"(*I think it indicates there are 58 order 10 memory could be used*)
> > could be used?
> >
> > Here is the related log:
> >
> > [ 2161.623563] xxxx: page allocation failure: order:10,
> > mode:0x2084020(GFP_ATOMIC|__GFP_COMP)
>
> Most likely, the allocation wanted some other type of allocation.
> The (C) on the order-10 says it's an CMA area.
>
>         static const char types[MIGRATE_TYPES] = {
>                 [MIGRATE_UNMOVABLE]     = 'U',
>                 [MIGRATE_MOVABLE]       = 'M',
>                 [MIGRATE_RECLAIMABLE]   = 'E',
>                 [MIGRATE_HIGHATOMIC]    = 'H',
> #ifdef CONFIG_CMA
>                 [MIGRATE_CMA]           = 'C',
> #endif
> #ifdef CONFIG_MEMORY_ISOLATION
>                 [MIGRATE_ISOLATE]       = 'I',
> #endif
>
> If the call was for an unmovable, movable, reclaimable, or highatomic
> allocation, you lose.
>
> If you look at the source for alloc_ap_req(), you find it wants
> GFP_ATOMIC, not
> CMA.  And your box is fresh out of contiguous order-10 spaces that aren't
> CMA,
> and you're down to your last 3 order-9 flagged as (UEC).
>
> I admit I find it a tad suspicious that the USB gadget driver asks for a 4M
> chunk of memory.  Does USB actually support single transfers that large?
> (I'm
> not a USB expert)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200619/2d0a7f91/attachment.html>


More information about the Kernelnewbies mailing list