提交 f0993522 编写于 作者: L Liu Shixin 提交者: Yongqiang Liu

mm/memory.c: update the first page in clear_gigantic_page_chunk

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I57SM0
CVE: NA

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

Patch "mm: parallelize clear_gigantic_page" make clear_gigantic_page
to be parallelized. But forgot to update the first page which results the
first page for each block is still the head page. Fix it by calculating
the first page for each block.

By the way, add a check to pointer p in order to prevent kernel panic.

Fixes: ae0cd4d4 ("mm: parallelize clear_gigantic_page")
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYongqiang Liu <liuyongqiang13@huawei.com>
上级 1bc9fed3
...@@ -4721,14 +4721,15 @@ static int clear_gigantic_page_chunk(unsigned long start, unsigned long end, ...@@ -4721,14 +4721,15 @@ static int clear_gigantic_page_chunk(unsigned long start, unsigned long end,
struct cgp_args *args) struct cgp_args *args)
{ {
struct page *base_page = args->base_page; struct page *base_page = args->base_page;
struct page *p = base_page; struct page *p = mem_map_offset(base_page, start);
unsigned long addr = args->addr; unsigned long addr = args->addr;
unsigned long i; unsigned long i;
might_sleep(); might_sleep();
for (i = start; i < end; i++, p = mem_map_next(p, base_page, i)) { for (i = start; i < end; i++, p = mem_map_next(p, base_page, i)) {
cond_resched(); cond_resched();
clear_user_highpage(p, addr + i * PAGE_SIZE); if (p)
clear_user_highpage(p, addr + i * PAGE_SIZE);
} }
return KTASK_RETURN_SUCCESS; return KTASK_RETURN_SUCCESS;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册