Linux内核中内存管理相关配置项的详细解析5

接前一篇文章:Linux内核中内存管理相关配置项的详细解析4

三、Page allocator randomization

对应配置变量为:CONFIG_SHUFFLE_PAGE_ALLOCATOR。

此项只有选中和不选中两种状态,默认为选中。

此项的内核源码详细解释为:

Randomization of the page allocator improves the average

utilization of a direct-mapped memory-side-cache. See section

5.2.27 Heterogeneous Memory Attribute Table (HMAT) in the ACPI

6.2a specification for an example of how a platform advertises

the presence of a memory-side-cache. There are also incidental

security benefits as it reduces the predictability of page

allocations to compliment SLAB_FREELIST_RANDOM, but the

default granularity of shuffling on the "MAX_ORDER - 1" i.e,

10th order of pages is selected based on cache utilization

benefits on x86.

While the randomization improves cache utilization it may

negatively impact workloads on platforms without a cache. For

this reason, by default, the randomization is enabled only

after runtime detection of a direct-mapped memory-side-cache.

Otherwise, the randomization may be force enabled with the

'page_alloc.shuffle' kernel command line parameter.

Say Y if unsure.

页面分配器的随机化提高了直接映射的内存侧缓存的平均利用率。请参阅ACPI 6.2a规范中的第5.2.27节异构内存属性表(HMAT),以了解平台如何通告memory-side-cache的存在。还有一些附带的安全好处,因为它降低了页面分配的可预测性,以补充SLAB_FREELIST_RANDOM,但是在“MAX_ORDER-1”上混洗(shufffle)的默认粒度,即页面的第10个顺序是基于x86上的缓存利用率优势选择的。

虽然随机化提高了缓存利用率,但它可能会对没有缓存的平台上的工作负载产生负面影响。出于这个原因,默认情况下,只有在运行时检测到直接映射的内存侧缓存后,才会启用随机化。否则,可以使用“page_alloc.shuffle”内核命令行参数强制启用随机化。

如果不确定,选择Y。

四、Disable heap randomization

对应配置变量为:CONFIG_COMPAT_BRK。

此项只有选中和不选中两种状态,默认为不选中。

此项的内核源码详细解释为:

Randomizing heap placement makes heap exploits harder, but it

also breaks ancient binaries (including anything libc5 based).

This option changes the bootup default to heap randomization

disabled, and can be overridden at runtime by setting

/proc/sys/kernel/randomize_va_space to 2.

On non-ancient distros (post-2000 ones) N is usually a safe choice.

随机放置堆使堆利用更加困难,但它也打破了古老的二进制(包括任何基于libc5的二进制)。此选项将引导默认设置更改为堆随机化禁用,并且可以在运行时通过将/proc/sys/kernel/randomize_va_saspace设置为2来覆盖。

在非古代发行版(2000年后发行版)上,N通常是一个安全的选择。

五、Sparse Memory virtual memmap

对应配置变量为:CONFIG_SPARSEMEM_VMEMMAP。

此项默认选中。

此项的内核源码详细解释为:

SPARSEMEM_VMEMMAP uses a virtually mapped memmap to optimise

pfn_to_page and page_to_pfn operations. This is the most

efficient option when sufficient kernel resources are available.

SPARSEMEM_VMEMMAP使用虚拟映射的memmap来优化pfn_to_page和page_to_pfn操作。当有足够的内核资源可用时,这是最有效的选项。

猜你喜欢

转载自blog.csdn.net/phmatthaus/article/details/131164138