From: "Valdis Klētnieks" <valdis.kletnieks@vt.edu>
To: 孙世龙 sunshilong <sunshilong369@gmail.com>
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 03:14:02 -0400 [thread overview]
Message-ID: <466244.1592550842@turing-police> (raw)
In-Reply-To: <CAAvDm6aiqYuRL3=pVq=_j18=o+6z+wb-zdrLnkKRqWnuG_bTrA@mail.gmail.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: Type: text/plain; charset=us-ascii, Size: 1015 bytes --]
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: application/pgp-signature, Size: 832 bytes --]
[-- Attachment #2: Type: text/plain, Size: 170 bytes --]
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
next prev parent reply other threads:[~2020-06-19 7:14 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 [this message]
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=466244.1592550842@turing-police \
--to=valdis.kletnieks@vt.edu \
--cc=Kernelnewbies@kernelnewbies.org \
--cc=sunshilong369@gmail.com \
/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).