From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Arjan van de Ven <arjan@infradead.org>
Cc: Andrew Morton <akpm@osdl.org>, linux-mm@kvack.org
Subject: Re: follow_page()
Date: Thu, 11 Nov 2004 22:58:13 +1100 [thread overview]
Message-ID: <419353D5.2080902@yahoo.com.au> (raw)
In-Reply-To: <1100171453.2646.29.camel@laptop.fenrus.org>
Arjan van de Ven wrote:
>>>most likely it's because the intent to write to it is given.
>>>It's cheaper for the OS to mark a pagetable dirty than it's for the CPU
>>>to do so (example, on a Pentium 4 it can easily take the cpu 2000 to
>>>4000 cycles to flip the dirty bit on the PTE). So if you KNOW you're
>>>going to write to it (and thus the intent parameter) you can save a big
>>>chunk of those cycles.
>>
>>But it's racy. writeback can write-and-clean the page before we've
>>modified its contents. Whether the page contents are altered via disk DMA
>>or a memset or whatever, we can lose the data. Except callers are
>>correctly dirtying the page after modifying it anyway.
>
>
> so in the race case you get the hit of those 4000 cycles... still optimizes the non-race case
> (so I'd agree that nothing should depend on this function dirtying it; it's a pre-dirty that's an
> optimisation)
>
Only it doesn't mark the pte dirty, does it?
if (pfn_valid(pfn)) {
page = pfn_to_page(pfn);
if (write && !pte_dirty(pte) && !PageDirty(page))
set_page_dirty(page);
mark_page_accessed(page);
return page;
}
So the CPU will still need to flip the dirty bit on the next write anyway.
It must be some leftover cruft to try to ensure the dirty bit doesn't get lost,
because it's going out of its way not to set the page dirty if the pte is dirty.
Kill it..?
--
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:"aart@kvack.org"> aart@kvack.org </a>
next prev parent reply other threads:[~2004-11-11 11:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2004-11-11 10:40 follow_page() Andrew Morton
2004-11-11 10:56 ` follow_page() Arjan van de Ven
2004-11-11 11:06 ` follow_page() Andrew Morton
2004-11-11 11:10 ` follow_page() Arjan van de Ven
2004-11-11 11:58 ` Nick Piggin [this message]
2004-11-11 12:11 ` follow_page() Andrew Morton
2004-11-11 12:20 ` follow_page() Nick Piggin
2004-11-11 12:16 ` follow_page() Arjan van de Ven
2004-11-11 12:27 ` follow_page() Nick Piggin
2004-11-11 12:46 ` follow_page() Arjan van de Ven
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=419353D5.2080902@yahoo.com.au \
--to=nickpiggin@yahoo.com.au \
--cc=akpm@osdl.org \
--cc=arjan@infradead.org \
--cc=linux-mm@kvack.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox