From: Ma Wupeng <mawupeng1@huawei.com> hulk inclusion category: feature bugzilla: https://atomgit.com/openeuler/kernel/issues/9826 -------------------------------- Set flag VM_PBHA_BIT0 for global init task during #PF. Signed-off-by: Ma Wupeng <mawupeng1@huawei.com> Signed-off-by: Fanhua Li <lifanhua5@huawei.com> Signed-off-by: Jiacheng Yu <yujiacheng3@huawei.com> --- Changes in v3: - only flag VMAs that belong to current->mm - refresh vma->vm_page_prot after setting VM_PBHA_BIT0 --- include/linux/pbha.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/linux/pbha.h b/include/linux/pbha.h index 9d004c833745..d03a29cc001a 100644 --- a/include/linux/pbha.h +++ b/include/linux/pbha.h @@ -43,6 +43,12 @@ static inline pte_t maybe_mk_pbha_bit0(pte_t pte, struct vm_area_struct *vma) if (!system_support_pbha_bit0()) return pte; + if (unlikely(is_global_init(current)) && vma->vm_mm == current->mm && + !(vma->vm_flags & VM_PBHA_BIT0)) { + ACCESS_PRIVATE(vma, __vm_flags) |= VM_PBHA_BIT0; + vma_set_page_prot(vma); + } + if (vma->vm_flags & VM_PBHA_BIT0) pte = pte_mkpbha(pte, PBHA_VAL_BIT0);