kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: "孙世龙 sunshilong" <sunshilong369@gmail.com>
To: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
Cc: Kernelnewbies@kernelnewbies.org
Subject: Re: Why does “page allocation failure” occur whereas there are still “58*4096kB (C)” could be used?
Date: Fri, 19 Jun 2020 14:56:20 +0800	[thread overview]
Message-ID: <CAAvDm6aiqYuRL3=pVq=_j18=o+6z+wb-zdrLnkKRqWnuG_bTrA@mail.gmail.com> (raw)
In-Reply-To: <459330.1592542115@turing-police>


[-- Attachment #1.1: Type: text/plain, Size: 2757 bytes --]

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

[-- Attachment #1.2: Type: text/html, Size: 3732 bytes --]

[-- Attachment #2: Type: text/plain, Size: 170 bytes --]

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2020-06-19  6:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-18  6:21 Why does “page allocation failure” occur whereas there are still “58*4096kB (C)” could be used? 孙世龙
2020-06-19  4:48 ` Valdis Klētnieks
2020-06-19  6:56   ` 孙世龙 sunshilong [this message]
2020-06-19  7:14     ` Valdis Klētnieks
2020-06-20  5:53       ` 孙世龙 sunshilong
2020-06-20  9:51         ` Valdis Klētnieks

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAvDm6aiqYuRL3=pVq=_j18=o+6z+wb-zdrLnkKRqWnuG_bTrA@mail.gmail.com' \
    --to=sunshilong369@gmail.com \
    --cc=Kernelnewbies@kernelnewbies.org \
    --cc=valdis.kletnieks@vt.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).