Redhat 7.1内核进程堆栈大小从8K到16KB

时间:2022-09-13 17:06:42

Reading the release note of Redhat 7.1, I read this:

阅读Redhat 7.1的发行说明,我读到了这个:

Process Stack Size Increased from 8KB to 16KB
Since Red Hat Enterprise Linux 7.1, the kernel process stack size has been increased from 8KB to 16KB to help large processes that use stack space.

I know the kernel process stack are resident memory and the allocation is made when processes are created and that memory needs to be contiguous, In x86_64 with page size of 4096 bytes, the kernel will need to find 4 pages intend of 2 pages for the process stack.

我知道内核进程堆栈是常驻内存,并且在创建进程并且内存需要连续时进行分配。在x86_64中,页面大小为4096字节,内核需要找到4页打算2页进程堆。

This feature can be a problem when the kernel memory is fragmented? With one process kernel stack size, will be more easier to have a problem with process creation when the memory will be fragmented?

当内核内存碎片化时,此功能可能会出现问题?使用一个进程内核堆栈大小,当内存被分段时,更容易出现进程创建问题?

2 个解决方案

#1


The kernel often needs to allocate a set of one or more pages which are physically contiguous. This may be necessary while allocating buffers (required by drivers for data transfers such as DMA) or when creating a process stack.

内核通常需要分配一组物理上连续的一个或多个页面。在分配缓冲区(驱动程序所需的数据传输,如DMA)或创建进程堆栈时,这可能是必要的。

Typically, to meet such requirements, kernel attempts to avoid fragmentation by allocating pages which are physically contiguous and additionally freed pages are merged/grouped into larger physically contiguous group of pages (if available). This is handled by the memory management sub-system and the buddy allocator. Now when your stack (8k or 16k in RHEL7) is created when the program has starts executing.

通常,为了满足这样的要求,内核尝试通过分配物理上连续的页面来避免分段,并且另外释放的页面被合并/分组成更大的物理连续的页面组(如果可用)。这由内存管理子系统和伙伴分配器处理。现在,当程序开始执行时,会创建堆栈(在RHEL7中为8k或16k)。

If kernel is unable to obtain or allocate a the requested set of physically contiguous pages (either 2 for 8k stack or 4 for 16k stack assuming 4k page size), then this could potentially lead to page allocation failures, order:2. (i.e 2^2=4 pages * 4K). The order depends on the size of your physically contiguous pages requested. We can observe the /proc/buddyinfo file during the time when page allocation failures occur, it could show signs of physically memory being fragmented.

如果内核无法获取或分配所请求的一组物理上连续的页面(2个用于8k堆栈,或者4个用于16k堆栈,假设4k页面大小),那么这可能会导致页面分配失败,顺序为:2。 (即2 ^ 2 = 4页* 4K)。订单取决于您请求的物理连续页面的大小。我们可以在发生页面分配失败的时候观察/ proc / buddyinfo文件,它可能会显示物理内存碎片的迹象。

#2


Yes.

When memory is fragmented finding stack space can be a problem.

当内存碎片化时,查找堆栈空间可能是个问题。

#1


The kernel often needs to allocate a set of one or more pages which are physically contiguous. This may be necessary while allocating buffers (required by drivers for data transfers such as DMA) or when creating a process stack.

内核通常需要分配一组物理上连续的一个或多个页面。在分配缓冲区(驱动程序所需的数据传输,如DMA)或创建进程堆栈时,这可能是必要的。

Typically, to meet such requirements, kernel attempts to avoid fragmentation by allocating pages which are physically contiguous and additionally freed pages are merged/grouped into larger physically contiguous group of pages (if available). This is handled by the memory management sub-system and the buddy allocator. Now when your stack (8k or 16k in RHEL7) is created when the program has starts executing.

通常,为了满足这样的要求,内核尝试通过分配物理上连续的页面来避免分段,并且另外释放的页面被合并/分组成更大的物理连续的页面组(如果可用)。这由内存管理子系统和伙伴分配器处理。现在,当程序开始执行时,会创建堆栈(在RHEL7中为8k或16k)。

If kernel is unable to obtain or allocate a the requested set of physically contiguous pages (either 2 for 8k stack or 4 for 16k stack assuming 4k page size), then this could potentially lead to page allocation failures, order:2. (i.e 2^2=4 pages * 4K). The order depends on the size of your physically contiguous pages requested. We can observe the /proc/buddyinfo file during the time when page allocation failures occur, it could show signs of physically memory being fragmented.

如果内核无法获取或分配所请求的一组物理上连续的页面(2个用于8k堆栈,或者4个用于16k堆栈,假设4k页面大小),那么这可能会导致页面分配失败,顺序为:2。 (即2 ^ 2 = 4页* 4K)。订单取决于您请求的物理连续页面的大小。我们可以在发生页面分配失败的时候观察/ proc / buddyinfo文件,它可能会显示物理内存碎片的迹象。

#2


Yes.

When memory is fragmented finding stack space can be a problem.

当内存碎片化时,查找堆栈空间可能是个问题。