virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Rusty Russell <rusty@rustcorp.com.au>
Cc: virtualization@lists.linux-foundation.org,
	linux-kernel@vger.kernel.org, linux-s390@vger.kernel.org,
	virtualization@lists.osdl.org, akpm@osdl.org,
	nickpiggin@yahoo.com.au, frankeh@watson.ibm.com,
	hugh@veritas.com
Subject: Re: [patch 1/6] Guest page hinting: core + volatile page cache.
Date: Thu, 13 Mar 2008 10:24:48 +0100	[thread overview]
Message-ID: <1205400288.26537.13.camel@localhost> (raw)
In-Reply-To: <200803131012.23420.rusty@rustcorp.com.au>

On Thu, 2008-03-13 at 10:12 +1100, Rusty Russell wrote:
> On Thursday 13 March 2008 00:21:33 Martin Schwidefsky wrote:
> > @@ -957,6 +975,19 @@ struct page *follow_page(struct vm_area_
> >
> >  	if (flags & FOLL_GET)
> >  		get_page(page);
> > +
> > +	if (flags & FOLL_GET) {
> > +		/*
> > +		 * The page is made stable if a reference is acquired.
> > +		 * If the caller does not get a reference it implies that
> > +		 * the caller can deal with page faults in case the page
> > +		 * is swapped out. In this case the caller can deal with
> > +		 * discard faults as well.
> > +		 */
> > +		if (unlikely(!page_make_stable(page)))
> > +			goto out_discard;
> > +	}
> 
> Dumb comment: seems like this if could be folded into the one above.

In this patch yes, but a later patch adds a condition:

-       if (flags & FOLL_GET) {
+       if ((flags & FOLL_GET) || (vma->vm_flags & VM_LOCKED)) {


> > + * Attempts to change the state of a page to volatile.
> > + * If there is something preventing the state change the page stays
> > + * int its current state.
> 
> Typo "int its current state".

Fixed.

> >  		return NULL;
> >
> >  	pte = pte_offset_map(pmd, address);
> > +	ptl = pte_lockptr(mm, pmd);
> >  	/* Make a quick check before getting the lock */
> > +#ifndef CONFIG_PAGE_STATES
> > +	/*
> > +	 * If the page table lock for this pte is taken we have to
> > +	 * assume that someone might be mapping the page. To solve
> > +	 * the race of a page discard vs. mapping the page we have
> > +	 * to serialize the two operations by taking the lock,
> > +	 * otherwise we end up with a pte for a page that has been
> > +	 * removed from page cache by the discard fault handler.
> > +	 */
> > +	if (!spin_is_locked(ptl))
> > +#endif
> >  	if (!pte_present(*pte)) {
> >  		pte_unmap(pte);
> >  		return NULL;
> >  	}
> >
> > -	ptl = pte_lockptr(mm, pmd);
> >  	spin_lock(ptl);
> >  	if (pte_present(*pte) && page_to_pfn(page) == pte_pfn(*pte)) {
> >  		*ptlp = ptl;
> 
> Did you really mean ifndef here?

That is a major nit. This should be an #ifdef. In previous versions the
complete "if (!pte_present(*pte)) { }" is ifdefed, the later versions
use the !spin_is_locked condition. Only I forgot to invert the #ifndef.
Fixed.

> (BTW: I'm just reading through the code, not really understanding it, so
> this is not a real review).

I take the small review anytime. Already found one major nit.

-- 
blue skies,
  Martin.

"Reality continues to ruin my life." - Calvin.

  reply	other threads:[~2008-03-13  9:24 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-12 13:21 [patch 0/6] Guest page hinting version 6 Martin Schwidefsky
2008-03-12 13:21 ` [patch 1/6] Guest page hinting: core + volatile page cache Martin Schwidefsky
2008-03-12 23:12   ` Rusty Russell
2008-03-13  9:24     ` Martin Schwidefsky [this message]
2008-03-12 13:21 ` [patch 2/6] Guest page hinting: volatile swap cache Martin Schwidefsky
2008-03-12 13:21 ` [patch 3/6] Guest page hinting: mlocked pages Martin Schwidefsky
2008-03-12 23:27   ` Rusty Russell
2008-03-13  9:13     ` Martin Schwidefsky
2008-03-12 13:21 ` [patch 4/6] Guest page hinting: writable page table entries Martin Schwidefsky
2008-03-12 23:35   ` Rusty Russell
2008-03-13  9:11     ` Martin Schwidefsky
2008-03-12 13:21 ` [patch 5/6] Guest page hinting: minor fault optimization Martin Schwidefsky
2008-03-12 13:21 ` [patch 6/6] Guest page hinting: s390 support Martin Schwidefsky
2008-03-12 16:19   ` Jeremy Fitzhardinge
2008-03-12 16:28     ` Martin Schwidefsky
2008-03-12 16:44       ` Jeremy Fitzhardinge
2008-03-12 16:59         ` Martin Schwidefsky
2008-03-12 17:48           ` Jeremy Fitzhardinge
2008-03-12 20:04             ` Anthony Liguori
2008-03-12 20:45               ` Jeremy Fitzhardinge
2008-03-12 20:56                 ` Anthony Liguori
2008-03-12 21:36                   ` Jeremy Fitzhardinge
2008-03-13  9:45                     ` Martin Schwidefsky
2008-03-13 16:07                       ` Jeremy Fitzhardinge
2008-03-13 16:17                         ` Jeremy Fitzhardinge
2008-03-13 16:55                           ` Martin Schwidefsky
2008-03-13 17:05                             ` Jeremy Fitzhardinge
2008-03-13 17:23                               ` Martin Schwidefsky
2008-03-13  9:42                   ` Martin Schwidefsky
2008-03-13  9:36                 ` Martin Schwidefsky
2008-03-13  9:32               ` Martin Schwidefsky
2008-03-12 22:41 ` [patch 0/6] Guest page hinting version 6 Rusty Russell
2008-03-13  9:47   ` Martin Schwidefsky
2008-03-13 16:57 ` Hugh Dickins
2008-03-13 17:14   ` Martin Schwidefsky
2008-03-13 17:45   ` Zachary Amsden
2008-03-13 19:45     ` Andrea Arcangeli
2008-03-13 21:41       ` Zachary Amsden
2008-03-13 18:41   ` Jeremy Fitzhardinge
2008-03-13 18:55     ` Hugh Dickins
2008-03-13 19:53       ` Zachary Amsden
2008-03-14 18:30         ` Jeremy Fitzhardinge
2008-03-14 21:32           ` Zachary Amsden
2008-03-14 21:37             ` Jeremy Fitzhardinge
2008-03-17  9:21             ` Martin Schwidefsky
2008-05-06 15:33   ` Martin Schwidefsky
2008-05-06 19:46     ` Rik van Riel
2008-05-07  3:49       ` Zachary Amsden
2008-05-07  7:00         ` Martin Schwidefsky
  -- strict thread matches above, loose matches on Subject: below --
2009-03-27 15:09 [patch 0/6] Guest page hinting version 7 Martin Schwidefsky
2009-03-27 15:09 ` [patch 1/6] Guest page hinting: core + volatile page cache Martin Schwidefsky
2009-03-27 22:57   ` Rik van Riel
2009-03-29 13:56     ` Martin Schwidefsky
2009-03-29 14:35       ` Rik van Riel
     [not found] <20070628164049.118610355@de.ibm.com>
2007-06-28 16:40 ` Martin Schwidefsky
2007-05-11 13:58 [patch 0/6] [rfc] guest page hinting version 5 Martin Schwidefsky
2007-05-11 13:58 ` [patch 1/6] Guest page hinting: core + volatile page cache Martin Schwidefsky
2007-05-11 14:45   ` Valdis.Kletnieks
2007-05-11 14:53     ` Martin Schwidefsky

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=1205400288.26537.13.camel@localhost \
    --to=schwidefsky@de.ibm.com \
    --cc=akpm@osdl.org \
    --cc=frankeh@watson.ibm.com \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=rusty@rustcorp.com.au \
    --cc=virtualization@lists.linux-foundation.org \
    --cc=virtualization@lists.osdl.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;
as well as URLs for NNTP newsgroup(s).