How do you comprehend the saying that the kernel's memory is not pageable whereas get_free_page use a page-oriented technique?

孙世龙 sunshilong sunshilong369 at gmail.com
Sat Jun 20 05:39:31 EDT 2020


>> Unfortunately for kernel developers, allocating memory in the kernel
>> is not as simple as allocating memory in userspace. A number of
>> factors contribute to the complication, among them:
>> The kernel is limited to about 1GB of virtual and physical memory.
>> **The kernel's memory is not pageable.**
>
>> If a module needs to allocate big chunks of memory, it is usually
>> better to use a page-oriented technique.
>
>Due to memory fragmentation, if a module needs (say) 2M of
>memory for an I/O buffer, it's more likely to be able to allocate
>512 4K pages scattered through the 1GB of memory than it
>is to get 1 contiguous chunk of memory.
>
>The fact it's not pageable doesn't mean that pages aren't relevant
>as the unit of allocation.

Thank you for your help.

     For the saying that the kernel's memory is not pageable, I think the
word "pageable" should be understood in this way:
    Linux keeps the whole kernel in physical memory at all the times and no
such memory would be temporarily moved to swap even if it is not currently
in use.
    Am I right?

   If my understanding is right, one more question raises, what about the
memory related to the user processes, e.g. process control block?
Can it be swapped out?

Thank you for your attention to this matter.
Look forward to hearing from you.

Valdis Klētnieks <valdis.kletnieks at vt.edu> 于2020年6月20日周六 下午5:11写道:

> On Sat, 20 Jun 2020 14:18:21 +0800, 孙世龙 sunshilong said:
>
> > Unfortunately for kernel developers, allocating memory in the kernel
> > is not as simple as allocating memory in userspace. A number of
> > factors contribute to the complication, among them:
> > The kernel is limited to about 1GB of virtual and physical memory.
> > **The kernel's memory is not pageable.**
>
> > If a module needs to allocate big chunks of memory, it is usually
> > better to use a page-oriented technique.
>
> Due to memory fragmentation, if a module needs (say) 2M of
> memory for an I/O buffer, it's more likely to be able to allocate
> 512 4K pages scattered through the 1GB of memory than it
> is to get 1 contiguous chunk of memory.
>
> The fact it's not pageable doesn't mean that pages aren't relevant
> as the unit of allocation.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20200620/ae472488/attachment.html>


More information about the Kernelnewbies mailing list