All of lore.kernel.org
 help / color / mirror / Atom feed
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: Why do we set _PAGE_DIRTY for page tables?
Date: Tue, 22 Apr 2014 19:51:22 -0700	[thread overview]
Message-ID: <53572AAA.4070207@zytor.com> (raw)
In-Reply-To: <CA+55aFwsPs12_57YEBHdb4ti1BXSuDX_RPSf6S4JSRLGK_2X7Q@mail.gmail.com>

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>

WARNING: multiple messages have this Message-ID (diff)
From: "H. Peter Anvin" <hpa@zytor.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"linux-mm@kvack.org" <linux-mm@kvack.org>
Subject: Re: Why do we set _PAGE_DIRTY for page tables?
Date: Tue, 22 Apr 2014 19:51:22 -0700	[thread overview]
Message-ID: <53572AAA.4070207@zytor.com> (raw)
In-Reply-To: <CA+55aFwsPs12_57YEBHdb4ti1BXSuDX_RPSf6S4JSRLGK_2X7Q@mail.gmail.com>

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



  reply	other threads:[~2014-04-23  2:51 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2014-04-23  2:51     ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=53572AAA.4070207@zytor.com \
    --to=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mingo@kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.