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

孙世龙 sunshilong sunshilong369 at gmail.com
Sat Jun 20 01:53:13 EDT 2020


>> 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 at 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"... :)
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200620/70e05a0f/attachment.html>


More information about the Kernelnewbies mailing list