All of lore.kernel.org
 help / color / mirror / Atom feed
From: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Rik van Riel <riel@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	virtualization@lists.osdl.org, frankeh@watson.ibm.com,
	akpm@osdl.org, nickpiggin@yahoo.com.au, hugh@veritas.com
Subject: Re: [patch 4/6] Guest page hinting: writable page table entries.
Date: Wed, 1 Apr 2009 16:36:58 +0200	[thread overview]
Message-ID: <20090401163658.60f851ed@skybase> (raw)
In-Reply-To: <49D36B4E.7000702@redhat.com>

On Wed, 01 Apr 2009 09:25:34 -0400
Rik van Riel <riel@redhat.com> wrote:

> Martin Schwidefsky wrote:
> 
> This code has me stumped.  Does it mean that if a page already
> has the PageWritable bit set (and count_ok stays 0), we will
> always mark the page as volatile?
> 
> How does that work out on !s390?

No, we will not always mark the page as volatile. If PG_writable is
already set count_ok will stay 0 and a call to page_make_volatile is
done. This differs from page_set_volatile as it repeats all the
required checks, then calls page_set_volatile with a PageWritable(page)
as second argument. What state the page will get depends on the
architecture definition of page_set_volatile. For s390 this will do a
state transition to potentially volatile as the PG_writable bit is set.
On architecture that cannot check the dirty bit on a physical page basis
you need to make the page stable.

> >  /**
> > + * __page_check_writable() - check page state for new writable pte
> > + *
> > + * @page: the page the new writable pte refers to
> > + * @pte: the new writable pte
> > + */
> > +void __page_check_writable(struct page *page, pte_t pte, unsigned int offset)
> > +{
> > +	int count_ok = 0;
> > +
> > +	preempt_disable();
> > +	while (page_test_set_state_change(page))
> > +		cpu_relax();
> > +
> > +	if (!TestSetPageWritable(page)) {
> > +		count_ok = check_counts(page, offset);
> > +		if (check_bits(page) && count_ok)
> > +			page_set_volatile(page, 1);
> > +		else
> > +			/*
> > +			 * If two processes create a write mapping at the
> > +			 * same time check_counts will return false or if
> > +			 * the page is currently isolated from the LRU
> > +			 * check_bits will return false but the page might
> > +			 * be in volatile state.
> > +			 * We have to take care about the dirty bit so the
> > +			 * only option left is to make the page stable but
> > +			 * we can try to make it volatile a bit later.
> > +			 */
> > +			page_set_stable_if_present(page);
> > +	}
> > +	page_clear_state_change(page);
> > +	if (!count_ok)
> > +		page_make_volatile(page, 1);
> > +	preempt_enable();
> > +}
> > +EXPORT_SYMBOL(__page_check_writable);
> 
> 

-- 
blue skies,
   Martin.

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

--
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: Martin Schwidefsky <schwidefsky@de.ibm.com>
To: Rik van Riel <riel@redhat.com>
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	virtualization@lists.osdl.org, frankeh@watson.ibm.com,
	akpm@osdl.org, nickpiggin@yahoo.com.au, hugh@veritas.com
Subject: Re: [patch 4/6] Guest page hinting: writable page table entries.
Date: Wed, 1 Apr 2009 16:36:58 +0200	[thread overview]
Message-ID: <20090401163658.60f851ed@skybase> (raw)
In-Reply-To: <49D36B4E.7000702@redhat.com>

On Wed, 01 Apr 2009 09:25:34 -0400
Rik van Riel <riel@redhat.com> wrote:

> Martin Schwidefsky wrote:
> 
> This code has me stumped.  Does it mean that if a page already
> has the PageWritable bit set (and count_ok stays 0), we will
> always mark the page as volatile?
> 
> How does that work out on !s390?

No, we will not always mark the page as volatile. If PG_writable is
already set count_ok will stay 0 and a call to page_make_volatile is
done. This differs from page_set_volatile as it repeats all the
required checks, then calls page_set_volatile with a PageWritable(page)
as second argument. What state the page will get depends on the
architecture definition of page_set_volatile. For s390 this will do a
state transition to potentially volatile as the PG_writable bit is set.
On architecture that cannot check the dirty bit on a physical page basis
you need to make the page stable.

> >  /**
> > + * __page_check_writable() - check page state for new writable pte
> > + *
> > + * @page: the page the new writable pte refers to
> > + * @pte: the new writable pte
> > + */
> > +void __page_check_writable(struct page *page, pte_t pte, unsigned int offset)
> > +{
> > +	int count_ok = 0;
> > +
> > +	preempt_disable();
> > +	while (page_test_set_state_change(page))
> > +		cpu_relax();
> > +
> > +	if (!TestSetPageWritable(page)) {
> > +		count_ok = check_counts(page, offset);
> > +		if (check_bits(page) && count_ok)
> > +			page_set_volatile(page, 1);
> > +		else
> > +			/*
> > +			 * If two processes create a write mapping at the
> > +			 * same time check_counts will return false or if
> > +			 * the page is currently isolated from the LRU
> > +			 * check_bits will return false but the page might
> > +			 * be in volatile state.
> > +			 * We have to take care about the dirty bit so the
> > +			 * only option left is to make the page stable but
> > +			 * we can try to make it volatile a bit later.
> > +			 */
> > +			page_set_stable_if_present(page);
> > +	}
> > +	page_clear_state_change(page);
> > +	if (!count_ok)
> > +		page_make_volatile(page, 1);
> > +	preempt_enable();
> > +}
> > +EXPORT_SYMBOL(__page_check_writable);
> 
> 

-- 
blue skies,
   Martin.

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


  reply	other threads:[~2009-04-01 14:36 UTC|newest]

Thread overview: 115+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-27 15:09 [patch 0/6] Guest page hinting version 7 Martin Schwidefsky
2009-03-27 15:09 ` Martin Schwidefsky
2009-03-27 15:09 ` [patch 1/6] Guest page hinting: core + volatile page cache Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-03-27 22:57   ` Rik van Riel
2009-03-27 22:57     ` Rik van Riel
2009-03-29 13:56     ` Martin Schwidefsky
2009-03-29 13:56       ` Martin Schwidefsky
2009-03-29 14:35       ` Rik van Riel
2009-03-29 14:35         ` Rik van Riel
2009-03-27 15:09 ` [patch 2/6] Guest page hinting: volatile swap cache Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-04-01  2:10   ` Rik van Riel
2009-04-01  2:10     ` Rik van Riel
2009-04-01  8:13     ` Martin Schwidefsky
2009-04-01  8:13       ` Martin Schwidefsky
2009-03-27 15:09 ` [patch 3/6] Guest page hinting: mlocked pages Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-04-01  2:52   ` Rik van Riel
2009-04-01  2:52     ` Rik van Riel
2009-04-01  8:13     ` Martin Schwidefsky
2009-04-01  8:13       ` Martin Schwidefsky
2009-03-27 15:09 ` [patch 4/6] Guest page hinting: writable page table entries Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-04-01 13:25   ` Rik van Riel
2009-04-01 13:25     ` Rik van Riel
2009-04-01 14:36     ` Martin Schwidefsky [this message]
2009-04-01 14:36       ` Martin Schwidefsky
2009-04-01 14:45       ` Rik van Riel
2009-04-01 14:45         ` Rik van Riel
2009-03-27 15:09 ` [patch 5/6] Guest page hinting: minor fault optimization Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-04-01 15:33   ` Rik van Riel
2009-04-01 15:33     ` Rik van Riel
2009-03-27 15:09 ` [patch 6/6] Guest page hinting: s390 support Martin Schwidefsky
2009-03-27 15:09   ` Martin Schwidefsky
2009-04-01 16:18   ` Rik van Riel
2009-04-01 16:18     ` Rik van Riel
2009-03-27 23:03 ` [patch 0/6] Guest page hinting version 7 Dave Hansen
2009-03-27 23:03   ` Dave Hansen
2009-03-28  0:06   ` Rik van Riel
2009-03-28  0:06     ` Rik van Riel
2009-03-29 14:20     ` Martin Schwidefsky
2009-03-29 14:20       ` Martin Schwidefsky
2009-03-29 14:38       ` Rik van Riel
2009-03-29 14:38         ` Rik van Riel
2009-03-29 14:12   ` Martin Schwidefsky
2009-03-29 14:12     ` Martin Schwidefsky
2009-03-30 15:54     ` Dave Hansen
2009-03-30 15:54       ` Dave Hansen
2009-03-30 16:34       ` Martin Schwidefsky
2009-03-30 16:34         ` Martin Schwidefsky
2009-03-30 18:37       ` Jeremy Fitzhardinge
2009-03-30 18:37         ` Jeremy Fitzhardinge
2009-03-30 18:42         ` Rik van Riel
2009-03-30 18:42           ` Rik van Riel
2009-03-30 18:59           ` Jeremy Fitzhardinge
2009-03-30 18:59             ` Jeremy Fitzhardinge
2009-03-30 20:02             ` Rik van Riel
2009-03-30 20:02               ` Rik van Riel
2009-03-30 20:35               ` Jeremy Fitzhardinge
2009-03-30 20:35                 ` Jeremy Fitzhardinge
2009-03-30 21:38                 ` Dor Laor
2009-03-30 21:38                   ` Dor Laor
2009-03-30 22:16                   ` Izik Eidus
2009-03-30 22:16                     ` Izik Eidus
2009-03-28  6:35 ` Rusty Russell
2009-03-28  6:35   ` Rusty Russell
2009-03-29 14:23   ` Martin Schwidefsky
2009-03-29 14:23     ` Martin Schwidefsky
2009-04-02 11:32     ` Nick Piggin
2009-04-02 11:32       ` Nick Piggin
2009-04-02 15:52       ` Martin Schwidefsky
2009-04-02 15:52         ` Martin Schwidefsky
2009-04-02 16:18         ` Jeremy Fitzhardinge
2009-04-02 16:18           ` Jeremy Fitzhardinge
2009-04-02 16:23         ` Nick Piggin
2009-04-02 16:23           ` Nick Piggin
2009-04-02 19:06         ` Rik van Riel
2009-04-02 19:06           ` Rik van Riel
2009-04-02 19:22           ` Nick Piggin
2009-04-02 19:22             ` Nick Piggin
2009-04-02 20:05             ` Rik van Riel
2009-04-02 20:05               ` Rik van Riel
2009-04-03  0:50               ` Jeremy Fitzhardinge
2009-04-03  0:50                 ` Jeremy Fitzhardinge
2009-04-02 19:58           ` Jeremy Fitzhardinge
2009-04-02 19:58             ` Jeremy Fitzhardinge
2009-04-02 20:14             ` Rik van Riel
2009-04-02 20:14               ` Rik van Riel
2009-04-02 20:34               ` Jeremy Fitzhardinge
2009-04-02 20:34                 ` Jeremy Fitzhardinge
2009-04-03  8:49                 ` Martin Schwidefsky
2009-04-03  8:49                   ` Martin Schwidefsky
2009-04-03 18:19                   ` Jeremy Fitzhardinge
2009-04-03 18:19                     ` Jeremy Fitzhardinge
2009-04-06  7:21                     ` Martin Schwidefsky
2009-04-06  7:21                       ` Martin Schwidefsky
2009-04-06  7:32                       ` Nick Piggin
2009-04-06  7:32                         ` Nick Piggin
2009-04-06  7:32                         ` Nick Piggin
2009-04-06 19:23                       ` Jeremy Fitzhardinge
2009-04-06 19:23                         ` Jeremy Fitzhardinge
2009-04-02 19:27         ` Hugh Dickins
2009-04-02 19:27           ` Hugh Dickins
  -- strict thread matches above, loose matches on Subject: below --
2008-03-12 13:21 [patch 0/6] Guest page hinting version 6 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
2007-06-28 16:40 [patch 0/6] resend: guest page hinting version 5 Martin Schwidefsky
2007-06-28 16:40 ` [patch 4/6] Guest page hinting: writable page table entries Martin Schwidefsky
2007-06-28 16:40 ` Martin Schwidefsky
2007-06-28 16:40   ` Martin Schwidefsky, Martin Schwidefsky, Hubertus Franke, Himanshu Raj
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 4/6] Guest page hinting: writable page table entries Martin Schwidefsky
2007-05-11 13:58   ` Martin Schwidefsky, Martin Schwidefsky, Hubertus Franke, Himanshu Raj
2007-05-11 13:58   ` 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=20090401163658.60f851ed@skybase \
    --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-mm@kvack.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=riel@redhat.com \
    --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 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.