Skip to contentSkip to conversation

Why do we set _PAGE_DIRTY for page tables?

DISCUSSION H. Peter Anvin 2 participants 3 messages Apr 22, 2014 – Apr 23, 2014 Memory management

lore
Share & tools
lore
#0 lore raw

I just noticed this:

#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_DIRTY)
#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \
_PAGE_DIRTY)

Is there a reason we set _PAGE_DIRTY for page tables? It has no function, but doesn't do any harm either (the dirty bit is ignored for page tables)... it just looks funny to me.

-hpa

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#1 lore raw
Quoted 10 lines · H. Peter Anvin

I just noticed this:

#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_DIRTY)
#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \
_PAGE_DIRTY)

Is there a reason we set _PAGE_DIRTY for page tables? It has no function, but doesn't do any harm either (the dirty bit is ignored for page tables)... it just looks funny to me.

I think it just got copied, and at least the A bit does matter even in page tables (well, it gets updated, I don't know how much that "matters"). So the fact that D is ignored is actually the odd man out.

Linus

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>

#2 lore raw
Quoted 8 lines · Linus Torvalds
Quoted 7 lines · H. Peter Anvin

I just noticed this:

#define _PAGE_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | \
_PAGE_ACCESSED | _PAGE_DIRTY)
#define _KERNPG_TABLE (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | \
_PAGE_DIRTY)

Quoted 8 lines
Quoted 3 lines

Is there a reason we set _PAGE_DIRTY for page tables? It has no function, but doesn't do any harm either (the dirty bit is ignored for page tables)... it just looks funny to me.

I think it just got copied, and at least the A bit does matter even in page tables (well, it gets updated, I don't know how much that "matters"). So the fact that D is ignored is actually the odd man out.

Yes, not setting the A bit means the hardware will take an assist to set the bit for us, which is a waste of time if we don't care about it. The D bit is the one which made me wonder; I thought either it was just copy & paste, or that it got set to make it more analogous with large pages.

-hpa

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>