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: Sat, 20 Jun 2020 13:53:13 +0800	[thread overview]
Message-ID: <CAAvDm6YgHBmbzBPO=-Vhf5m-85wL-vrHWya=nx6LQH8dAOQxxQ@mail.gmail.com> (raw)
In-Reply-To: <466244.1592550842@turing-police>


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

>> 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)?
>
>Most parts of the kernel, when asking for very high-order allocations,
*will*
>have a fallback strategy to use smaller chunks. So, for instance,  if a
device
>need a 1M buffer and supports scatter-gather operations, if 1M of
contiguous
>memory isn't available, the kernel can ask for 4 256K chunks and have the
I/O
>directed into the 4 areas.  *However, if the memory *has* to be contiguous
(for*
>*example, no scatter/gather available, or it's for an array data
structure),*
>then it can't do that.

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

How can I know whether scatter/gather is available or not?
In another word, when it's available and when it's not?
I do not intend to ask the behavior of gadget driver.
I just wonder how I can confirm it in general.

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日周五 下午3:14写道:

> On Fri, 19 Jun 2020 14:56:20 +0800, 孙世龙 sunshilong said:
>
> > 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)?
>
> Most parts of the kernel, when asking for very high-order allocations,
> *will*
> have a fallback strategy to use smaller chunks. So, for instance,  if a
> device
> need a 1M buffer and supports scatter-gather operations, if 1M of
> contiguous
> memory isn't available, the kernel can ask for 4 256K chunks and have the
> I/O
> directed into the 4 areas.  However, if the memory *has* to be contiguous
> (for
> example, no scatter/gather available, or it's for an array data structure),
> then it can't do that.
>
> And in fact, that fallback could very well have happened in this case - I
> didn't bother chasing back to see if the gadget driver does recovery by
> allocating multiple smaller chunks.
>
> (That's a good "exercise for the student"... :)
>

[-- Attachment #1.2: Type: text/html, Size: 2850 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-20  5:53 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
2020-06-19  7:14     ` Valdis Klētnieks
2020-06-20  5:53       ` 孙世龙 sunshilong [this message]
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='CAAvDm6YgHBmbzBPO=-Vhf5m-85wL-vrHWya=nx6LQH8dAOQxxQ@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).