Commit 4e018573 authored by Zhou Guanghui's avatar Zhou Guanghui Committed by Jian Zhang
Browse files

mm: fix ignore cpuset enforcement

ascend inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I612UG


CVE: NA

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

Since the current condition ignores the cpuset enforcement by adding
__GFP_THISNODEi to the gfp_mask, this will result in allocations that
specify __GFP_THISNODE and non-cdm nodes not subject to cpuset
restrictions.

For example, procA pid 1000:
node 0 cpus: 0 1 2 3
node 0 free: 57199MB
node 1 cpus: 4 5 6 7
node 1 free: 55930MB

cpuset/test/cpuset.mems  1
cpuset/test/tasks        1000
cpuset/test/cpuset.cpus  0-3

No cdm node exists. When procA malloc 100MB memory, the result is:
node 0 cpus: 0 1 2 3
node 0 free: 57099MB
node 1 cpus: 4 5 6 7
node 1 free: 55930MB
This is not what we expected, and in fact 100 MB of memory should be
allocated from node1. The reason for this problem is that THP specifies
__GFP_THISNODE to attempt to allocate from the local node.

Therefore, the cpuset enforcement should be ignored only when explicitly
allocating memory from the cdm node using __GFP_ THISNODE.

Signed-off-by: default avatarZhou Guanghui <zhouguanghui1@huawei.com>
parent 7f67a4ea
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment