<div dir="ltr">>> Why doesn't the kernel use two memory blocks whose size is 2048KB(i.e.*oder 9 *)<br>>> instead of one block *order 10 *(you see, there are still three free blocks and<br>>> 2048KB*2=4096KB equivalent to the memory size of order 10)?<br>><br>>Most parts of the kernel, when asking for very high-order allocations, *will*<br>>have a fallback strategy to use smaller chunks. So, for instance, if a device<br>>need a 1M buffer and supports scatter-gather operations, if 1M of contiguous<br>>memory isn't available, the kernel can ask for 4 256K chunks and have the I/O<br>>directed into the 4 areas. <b>However, if the memory *has* to be contiguous (for</b><br>><b>example, no scatter/gather available, or it's for an array data structure),</b><br>>then it can't do that.<br><br>Thank you for the clarification.<br>I understand it on a deeper level with your help.<br><br>How can I know whether scatter/gather is available or not?<div>In another word, when it's available and when it's not?<br>I do not intend to ask the behavior of gadget driver.<br>I just wonder how I can confirm it in general.<br><div><br></div><div>Thank you for your attention to this matter.</div><div>Look forward to hearing from you.</div><div>Best regards.</div></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Valdis Klētnieks <<a href="mailto:valdis.kletnieks@vt.edu">valdis.kletnieks@vt.edu</a>> 于2020年6月19日周五 下午3:14写道:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On Fri, 19 Jun 2020 14:56:20 +0800, 孙世龙 sunshilong said:<br>
<br>
> Why doesn't the kernel use two memory blocks whose size is 2048KB(i.e.*oder 9 *)<br>
> instead of one block *order 10 *(you see, there are still three free blocks and<br>
> 2048KB*2=4096KB equivalent to the memory size of order 10)?<br>
<br>
Most parts of the kernel, when asking for very high-order allocations, *will*<br>
have a fallback strategy to use smaller chunks. So, for instance, if a device<br>
need a 1M buffer and supports scatter-gather operations, if 1M of contiguous<br>
memory isn't available, the kernel can ask for 4 256K chunks and have the I/O<br>
directed into the 4 areas. However, if the memory *has* to be contiguous (for<br>
example, no scatter/gather available, or it's for an array data structure),<br>
then it can't do that.<br>
<br>
And in fact, that fallback could very well have happened in this case - I<br>
didn't bother chasing back to see if the gadget driver does recovery by<br>
allocating multiple smaller chunks.<br>
<br>
(That's a good "exercise for the student"... :)<br>
</blockquote></div>