Commit 200321e8 authored by Ma Wupeng's avatar Ma Wupeng Committed by Wupeng Ma
Browse files

mm: mem_reliable: Add limiting the usage of reliable memory

hulk inclusion
category: feature
bugzilla: https://gitee.com/openeuler/kernel/issues/I8USBA


CVE: NA

--------------------------------

Add reliable limit for reliable user task, page cache and shmem.

1. For reliable user task:

There is a upper limit for all memory allocation if the following
conditions are met:
- gfp_zone(gfp & ~ GFP_RELIABLE) == ZONE_MOVABLE
- gfp & GFP_RELIABLE is true

Init tasks will alloc memory from non-mirrored region if their allocation
trigger limit.

The limit can be set or access via /proc/sys/vm/task_reliable_limit

2. For page cache:

This limit's default value is ULONG_MAX. User can update this value between
current user used reliable memory size and total reliable memory size.

Add interface /proc/sys/vm/pagecache_reliable_limit to set the
max size for reliable page cache, the max size can not beyond total
reliable ram.

the whole reliable memory feature depend on kernelcore=mirror,
and which depend on NUMA, so remove redundant code in UMA.

3. For shmem:

This limit is used to restrict the amount of mirrored memory by shmem.
This memory allocation will return no memory if reliable fallback is off
or fallback to non-mirrored region if reliable fallback on.

This limit can be set or access via
/proc/sys/vm/shmem_reliable_bytes_limit.
The default value of this limit is LONG_MAX. This limit can be set from 0
to the total size of mirrored memory.

Signed-off-by: default avatarChen Wandun <chenwandun@huawei.com>
Signed-off-by: default avatarMa Wupeng <mawupeng1@huawei.com>
parent e1767ef2
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment