All of lore.kernel.org
 help / color / mirror / Atom feed
* Why do we set _PAGE_DIRTY for page tables?
@ 2014-04-22 23:35 ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2014-04-22 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	Linus Torvalds, linux-mm@kvack.org

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Why do we set _PAGE_DIRTY for page tables?
@ 2014-04-22 23:35 ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2014-04-22 23:35 UTC (permalink / raw)
  To: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	Linus Torvalds, linux-mm@kvack.org

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why do we set _PAGE_DIRTY for page tables?
  2014-04-22 23:35 ` H. Peter Anvin
@ 2014-04-23  2:48   ` Linus Torvalds
  -1 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2014-04-23  2:48 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	linux-mm@kvack.org

On Tue, Apr 22, 2014 at 4:35 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> 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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why do we set _PAGE_DIRTY for page tables?
@ 2014-04-23  2:48   ` Linus Torvalds
  0 siblings, 0 replies; 6+ messages in thread
From: Linus Torvalds @ 2014-04-23  2:48 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	linux-mm@kvack.org

On Tue, Apr 22, 2014 at 4:35 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why do we set _PAGE_DIRTY for page tables?
  2014-04-23  2:48   ` Linus Torvalds
@ 2014-04-23  2:51     ` H. Peter Anvin
  -1 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2014-04-23  2:51 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	linux-mm@kvack.org

On 04/22/2014 07:48 PM, Linus Torvalds wrote:
> On Tue, Apr 22, 2014 at 4:35 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> 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.
> 

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 majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Why do we set _PAGE_DIRTY for page tables?
@ 2014-04-23  2:51     ` H. Peter Anvin
  0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2014-04-23  2:51 UTC (permalink / raw)
  To: Linus Torvalds
  Cc: Ingo Molnar, Thomas Gleixner, Linux Kernel Mailing List,
	linux-mm@kvack.org

On 04/22/2014 07:48 PM, Linus Torvalds wrote:
> On Tue, Apr 22, 2014 at 4:35 PM, H. Peter Anvin <hpa@zytor.com> wrote:
>> 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.
> 

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



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2014-04-23  2:51 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-04-22 23:35 Why do we set _PAGE_DIRTY for page tables? H. Peter Anvin
2014-04-22 23:35 ` H. Peter Anvin
2014-04-23  2:48 ` Linus Torvalds
2014-04-23  2:48   ` Linus Torvalds
2014-04-23  2:51   ` H. Peter Anvin
2014-04-23  2:51     ` H. Peter Anvin

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.