x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit
PATCH v2 1/1 x86/head/64: remove redundant check on level2_kernel_pgt's _PAGE_PRESENT bit
This patch tries to remove a redundant check on kernel code's PMD _PAGE_PRESENT attribute before fix up.
Current process looks like this:
pmd in [0, _text)
unset _PAGE_PRESENT
pmd in [_text, _end]
if (_PAGE_PRESENT)
fix up delta
pmd in (_end, 512)
unset _PAGE_PRESENT
Since we have compiled in _PAGE_PRESENT in this page table, it is not necessary to check _PAGE_PRESENT again before fixing up delta
---
v2: adjust the change log to emphasize the redundant check
--- arch/x86/kernel/head64.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/kernel/head64.c +1 -2
@@ -260,8 +260,7 @@ unsigned long __head __startup_64(unsigned long physaddr,/* fixup pages that are part of the kernel image */ for (; i <=pmd_index ((unsigned long )_end); i++) -if (pmd[i] & _PAGE_PRESENT) - pmd[i] += load_delta; + pmd[i] += load_delta;/* invalidate pages after the kernel image */ for (; i <PTRS_PER_PMD ; i++)
Signature · 1 line
2.34.1
Quoted 2 lines · Wei Yang
This patch tries to remove a redundant check on kernel code's PMD
_PAGE_PRESENTattribute before fix up.
Tries? s/This patch tries to r/R/
Quoted 10 lines
Current process looks like this:
pmd in [0,
_text)
unset_PAGE_PRESENT
pmd in [_text,_end]
if (_PAGE_PRESENT)
fix up delta
pmd in (_end, 512)
unset_PAGE_PRESENT
Quoted 2 lines
Since we have compiled in
_PAGE_PRESENTin this page table, it is not necessary to check_PAGE_PRESENTagain before fixing up delta
level2_kernel_pgt compiled with _PAGE_PRESENT set. The check is redundant.
Signature · 1 line
Kiryl Shutsemau / Kirill A. Shutemov
Thanks for comment.
Quoted 5 lines · Kirill A . Shutemov
Quoted 2 lines · Wei Yang
This patch tries to remove a redundant check on kernel code's PMD
_PAGE_PRESENTattribute before fix up.Tries? s/This patch tries to r/R/
Will use this one.
Quoted 11 lines
Quoted 11 lines
Current process looks like this:
pmd in [0,
_text)
unset_PAGE_PRESENT
pmd in [_text,_end]
if (_PAGE_PRESENT)
fix up delta
pmd in (_end, 512)
unset_PAGE_PRESENT
Quoted 6 lines
Quoted 2 lines
Since we have compiled in
_PAGE_PRESENTin this page table, it is not necessary to check_PAGE_PRESENTagain before fixing up delta
level2_kernel_pgtcompiled with_PAGE_PRESENTset. The check is redundant.
Will use this one, thanks
Quoted 3 lines
Signature · 2 lines
-- Kiryl Shutsemau / Kirill A. Shutemov
Signature · 2 lines
Wei Yang Help you, Help me