public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Petr Vandrovec <vandrove@vc.cvut.cz>
To: Hugh Dickins <hugh@veritas.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: Nick's core remove PageReserved broke vmware...
Date: Wed, 02 Nov 2005 23:39:28 +0100	[thread overview]
Message-ID: <43694020.8080208@vc.cvut.cz> (raw)
In-Reply-To: <Pine.LNX.4.61.0511022157130.18559@goblin.wat.veritas.com>

Hugh Dickins wrote:
> On Thu, 3 Nov 2005, Benjamin Herrenschmidt wrote:
> 
>>>Take a look at Andrew's educational comment on set_page_dirty_lock
>>>in mm/page-writeback.c.  You do have the list of pages you need to
>>>page_cache_release, don't you?  So it should be easy to dirty them.
>>
>>Ok, so just passing 'write' to get_user_pages() is good enough; right ?
> 
> 
> Not quite, I think: you need to pass 'write' to get_user_pages()
> initially; but at the end, if it was indeed writing into user space,
> you need to do the set_page_dirty_lock thing on each of the pages
> before page_cache_release, just in case a race cleaned them before
> the DMA completed.  I think (I've never used it myself).

Unfortunately at least for our use set_page_dirty{_lock} has an
unfortunate feature that it schedules writeback immediately.

get_user_pages() through __follow_page() calls set_page_dirty() only
if pte_dirty() bit is not set (I have no idea why it just does not
set pte dirty bit instead of doing set_page_dirty(), but there must
be some reason, yes?), so under normal condition page is marked
dirty in the page's structure only if it was not marked dirty
on pte level before.  This way page itself is marked dirty only after
somebody copies dirty bit from page tables to the page structure, which
can take a lot of time.

On other side when you do set_page_dirty(), page is in few seconds
written back to the disk - causing quite visible I/O load if you
perform get_user_pages()/set_page_dirty() when compared with
situation where you just mark PTE dirty after you are done with
page.

(for those interested, in the situation described above we are
doing get_user_pages() on the file mapped by MAP_SHARED to the
user's address space to get physical address of these pages,
then virtual machine monitor uses this physical address to fill
guest's pagetables, and later (once guest is done with page) we
mark page dirty and release page; performance difference between
set_page_dirty() and home grown ptep_set_dirty() is more than
visible...  but AGP memory in question is probably not
backed up by some writeable file, so it does not make difference
here)

					Petr


  parent reply	other threads:[~2005-11-02 22:39 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-01 19:30 Nick's core remove PageReserved broke vmware Petr Vandrovec
2005-11-02  0:34 ` Nick Piggin
2005-11-02  1:17   ` Petr Vandrovec
2005-11-02  2:09     ` Nick Piggin
2005-11-02 12:26     ` Hugh Dickins
2005-11-02 18:06       ` Petr Vandrovec
2005-11-02 21:04       ` Benjamin Herrenschmidt
2005-11-02 21:41         ` Hugh Dickins
2005-11-02 21:45           ` Benjamin Herrenschmidt
2005-11-02 22:02             ` Hugh Dickins
2005-11-02 22:22               ` Benjamin Herrenschmidt
2005-11-03  8:03                 ` Gleb Natapov
2005-11-03 13:32                   ` Hugh Dickins
2005-11-03 13:55                     ` Gleb Natapov
2005-11-03 21:21                       ` Benjamin Herrenschmidt
2005-11-02 22:39               ` Petr Vandrovec [this message]
2005-11-03  8:12               ` Gleb Natapov
2005-11-03 14:11                 ` Hugh Dickins
2005-11-03 14:22                   ` Gleb Natapov
2005-11-03 14:37                   ` Michael S. Tsirkin
2005-11-03 14:59                     ` Hugh Dickins
2005-11-03 15:09                       ` Gleb Natapov
2005-11-03 15:14                       ` Michael S. Tsirkin
2005-11-03 15:37                         ` Hugh Dickins
2005-11-03 15:53                           ` Gleb Natapov
2005-11-03 15:56                           ` Michael S. Tsirkin
2005-11-08 21:34                   ` Michael S. Tsirkin
2005-11-10 12:35                     ` Gleb Natapov
2005-11-10 12:48                       ` Michael S. Tsirkin
2005-11-10 12:49                         ` Gleb Natapov
2005-11-10 13:16                           ` Michael S. Tsirkin
2005-11-10 13:16                             ` Gleb Natapov
2005-11-10 13:21                             ` Hugh Dickins
2005-11-10 13:26                               ` Gleb Natapov
2005-11-10 13:15                         ` Hugh Dickins
2005-11-10 13:10                     ` Hugh Dickins
2005-11-10 13:37                       ` Michael S. Tsirkin
2005-11-10 13:55                         ` Hugh Dickins
2005-11-10 14:12                           ` Michael S. Tsirkin
2005-11-14 12:25                       ` Michael S. Tsirkin
2005-11-14 12:27                         ` Gleb Natapov
2005-11-14 12:34                           ` Michael S. Tsirkin
2005-11-14 12:40                             ` Hugh Dickins
2005-11-14 14:57                               ` Michael S. Tsirkin
2005-11-14 15:07                                 ` Gleb Natapov
2005-11-14 12:41                             ` Gleb Natapov
2005-11-14 14:52                       ` Michael S. Tsirkin
2005-11-14 15:00                         ` Gleb Natapov
2005-11-14 20:23                           ` Michael S. Tsirkin
2005-11-15  9:26                             ` Gleb Natapov
2005-11-14 15:58                         ` Hugh Dickins
2005-11-14 21:17                           ` Michael S. Tsirkin

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=43694020.8080208@vc.cvut.cz \
    --to=vandrove@vc.cvut.cz \
    --cc=benh@kernel.crashing.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    /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