Wrong comment due to pte_file()
The comment above other bit tests says "if pte_present is true", but the pte_file is backwards. A classic case of code changing from under comments. How about abolishing all comments? :-)
include/asm-i386/pgtable.h +4 -0
@@ -188,6 +188,10 @@static inline int pte_dirty (pte_t pte) {return (pte).pte_low & _PAGE_DIRTY; }static inline int pte_young (pte_t pte) {return (pte).pte_low & _PAGE_ACCESSED; }static inline int pte_write (pte_t pte) {return (pte).pte_low & _PAGE_RW; } + +/* +* The following only works if pte_present() is not true. +*/ static inline int pte_file (pte_t pte) {return (pte).pte_low & _PAGE_FILE; }static inline pte_t pte_rdprotect (pte_t pte) { (pte).pte_low &= ~_PAGE_USER;return pte; }
Quoted 2 lines · Pete Zaitcev
How about abolishing all comments?
Or all code.
include/asm-i386/pgtable.h
Quoted 2 lines
include/asm-i386/pgtable.h +0
-0
Thanks. There's another bogus comment doing the rounds as well:
#define _PAGE_FILE 0x040 /* pagecache or swap */
This is exactly wrong - this bit is used to distinguish pagecache from swap. See handle_pte_fault():
if (pte_file(entry)) return do_file_page(mm, vma, address, write_access, pte, pmd); return do_swap_page(mm, vma, address, pte, pmd, entry, write_access);
Some architectures got sneaky:
#define _PAGE_FILE 0x80000 /* pagecache or swap? */
ah-hah! That question mark *totally* changes the meaning and reveals all.
Pity those who follow after us. I shall fix it up.