* Wrong comment due to pte_file()
@ 2003-03-31 2:22 Pete Zaitcev
2003-03-31 2:37 ` Andrew Morton
0 siblings, 1 reply; 2+ messages in thread
From: Pete Zaitcev @ 2003-03-31 2:22 UTC (permalink / raw)
To: akpm, Ingo Molnar; +Cc: linux-kernel
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? :-)
diff -urN -X dontdiff linux-2.5.66/include/asm-i386/pgtable.h linux-2.5.66-sparc/include/asm-i386/pgtable.h
--- linux-2.5.66/include/asm-i386/pgtable.h 2003-03-24 14:01:14.000000000 -0800
+++ linux-2.5.66-sparc/include/asm-i386/pgtable.h 2003-03-30 16:35:04.000000000 -0800
@@ -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; }
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: Wrong comment due to pte_file()
2003-03-31 2:22 Wrong comment due to pte_file() Pete Zaitcev
@ 2003-03-31 2:37 ` Andrew Morton
0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2003-03-31 2:37 UTC (permalink / raw)
To: Pete Zaitcev; +Cc: mingo, linux-kernel
Pete Zaitcev <zaitcev@redhat.com> wrote:
>
> How about abolishing all comments?
Or all code.
> --- linux-2.5.66/include/asm-i386/pgtable.h 2003-03-24 14:01:14.000000000 -0800
> +++ linux-2.5.66-sparc/include/asm-i386/pgtable.h 2003-03-30 16:35:04.000000000 -0800
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-03-31 2:26 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-03-31 2:22 Wrong comment due to pte_file() Pete Zaitcev
2003-03-31 2:37 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.