!2291 mm: kzerod: a kernel zero page pool for anonymous pages
Merge Pull Request from: @xuexiaowei1
!2288
This submission implements a zero page memory pool, where a kernel thread is responsible for zeroing physical pages and placing them in the memory pool. When a zero page is needed, it can be obtained from the memory pool to avoid latency.
The implementation includes the following features:
1. It uses only one kernel thread to populate the memory pool to avoid excessive CPU resource 2. usage.
2. It establishes a dedicated memory pool for each CPU to avoid lock conflicts and NUMA-4. related delays.
3. It utilizes lock-free data structures as much as possible to avoid locking.
4. It employs load balancing to prevent imbalanced loads on per CPU zero page memory pools.
5. It utilizes Non Temporal instructions to zero physical pages and avoid cache pollution.
In terms of functionality, kzerod provides the following support:
1. It supports both common pages and transparent huge pages, and allows specifying the desired buddy order for zero pages.
2. It supports dynamic adjustment of the watermark, which can be set using files under /sys/module/kzerod/parameters/ to control the high watermark of the memory pool.
3. It supports disabling/enabling the memory pool, which can be done by echoing to /sys/module/kzerod/parameters/enabled to enable or disable kzerod.
4. It supports disabling/enabling transparent huge pages. When the transparent huge page policy is set to "never," kzerod releases all transparent huge pages in the pool and disables the transparent huge page zero page memory pool. When set to "always" or "madvise," kzerod re-enables the transparent huge page memory pool.
Link:https://gitee.com/openeuler/kernel/pulls/2291
Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: Jialin Zhang <zhangjialin11@huawei.com>