hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/IDB01L ---------------------------------------- NUMA_NO_NODE will be passed to numa_remote_hugetlb_nowatermark() if we echo xx > /proc/sys/vm/nr_hugepages. When hugetlb_nowatermark is enabled, numa_remote_hugetlb_nowatermark() will trigger wild-memory-access. To fix it, check nid whether is NUMA_NO_NODE before calling numa_remote_hugetlb_nowatermark(). Fixes: 3a1587ef612c ("mm/numa_remote: introduce hugetlb_nowatermark mode for remote node") Signed-off-by: Jinjiang Tu <tujinjiang@huawei.com> --- mm/hugetlb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index b00dda9db0c9..1a98b599c0b0 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3944,7 +3944,7 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, /* yield cpu to avoid soft lockup */ cond_resched(); - if (numa_remote_hugetlb_nowatermark(nid) && !drained && (nid != NUMA_NO_NODE)) { + if ((nid != NUMA_NO_NODE) && numa_remote_hugetlb_nowatermark(nid) && !drained) { hugetlb_drain_remote_pcp(h, nid); drained = true; } -- 2.43.0