[PATCH OLK-5.10] hugeltb: Fix null ptr exception during drain movable pcp

hulk inclusion category: bugfix bugzilla: https://gitee.com/openeuler/kernel/issues/ICLL1L -------------------------------- During our test, with movable_node enabled, null ptr exception will happen with the following command: echo 10 > /proc/sys/vm/nr_hugepages Which will lead to kernel panic with the following log: Unable to handle kernel paging request at virtual address 00000000000013f0 pc : set_max_huge_pages+0x52c/0x5fc lr : set_max_huge_pages+0x514/0x5fc Call trace: set_max_huge_pages+0x52c/0x5fc hugetlb_sysctl_handler+0xe4/0x10c proc_sys_call_handler+0x13c/0x260 proc_sys_write+0x18/0x3c new_sync_write+0xec/0x1a0 vfs_write+0x208/0x2b0 ksys_write+0x70/0x110 __arm64_sys_write+0x20/0x40 el0_sync+0x168/0x180 To fix this, stop drian pcp if nid is not valid. Signed-off-by: Wupeng Ma <mawupeng1@huawei.com> --- mm/hugetlb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index eff60dc4135d9..5307e9c2b0538 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3113,7 +3113,8 @@ static int set_max_huge_pages(struct hstate *h, unsigned long count, int nid, * drain pcp for movable zone to increase the success rate for * hugetlb memory allocation if movable_node enabled */ - if (movable_node_is_enabled() && count > persistent_huge_pages(h)) + if ((nid != NUMA_NO_NODE) && movable_node_is_enabled() && + count > persistent_huge_pages(h)) hugetlb_drain_movable_pcp(h, nid); while (count > persistent_huge_pages(h)) { -- 2.43.0

反馈: 您发送到kernel@openeuler.org的补丁/补丁集,已成功转换为PR! PR链接地址: https://gitee.com/openeuler/kernel/pulls/17231 邮件列表地址:https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/VT5... FeedBack: The patch(es) which you have sent to kernel@openeuler.org mailing list has been converted to a pull request successfully! Pull request link: https://gitee.com/openeuler/kernel/pulls/17231 Mailing list address: https://mailweb.openeuler.org/archives/list/kernel@openeuler.org/message/VT5...
participants (2)
-
patchwork bot
-
Wupeng Ma