Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ARM: update __swp_entry_to_pte() to use PTE_TYPE_FAULT

Swap entries use a faulting PTE which have the least two significant
bits as zero. Due to this, the use of PTE_TYPE_FAULT was overlooked,
but really should have been included in __swp_entry_to_pte().

Convert this macro to use PTE_TYPE_FAULT to properly document what is
going on here, and use __pte() to convert the swp_entry_t to a pte_t.

This results in no change to the resulting kernel image.

Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

+1 -1
+1 -1
arch/arm/include/asm/pgtable.h
··· 306 306 #define __swp_entry(type,offset) ((swp_entry_t) { ((type) << __SWP_TYPE_SHIFT) | ((offset) << __SWP_OFFSET_SHIFT) }) 307 307 308 308 #define __pte_to_swp_entry(pte) ((swp_entry_t) { pte_val(pte) }) 309 - #define __swp_entry_to_pte(swp) ((pte_t) { (swp).val }) 309 + #define __swp_entry_to_pte(swp) __pte((swp).val | PTE_TYPE_FAULT) 310 310 311 311 /* 312 312 * It is an error for the kernel to have more swap files than we can