linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Piggin <nickpiggin@yahoo.com.au>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: Christoph Lameter <clameter@sgi.com>,
	lkml <linux-kernel@vger.kernel.org>,
	linux-mm@kvack.org, Andi Kleen <ak@suse.de>
Subject: Re: [RFC] Event counters [1/3]: Basic counter functionality
Date: Tue, 03 Jan 2006 16:01:04 +1100	[thread overview]
Message-ID: <1136264464.5261.23.camel@npiggin-nld.site> (raw)
In-Reply-To: <20051231202602.GC3903@dmt.cnet>

On Sat, 2005-12-31 at 18:26 -0200, Marcelo Tosatti wrote:
> Hi Nick!
> 

Hey Marcelo!

> On Sat, Dec 31, 2005 at 06:54:25PM +1100, Nick Piggin wrote:
> > 
> > Hi Guys,
> > 
> > I've been waiting for some mm/ patches to clear from -mm before commenting
> > too much... however I see that this patch is actually against -mm itself,
> > with my __mod_page_state stuff in it... that makes the page state accounting
> > much lighter weight AND is not racy.
> 
> It is racy with reference to preempt (please refer to the race condition
> described above):
> 
> diff -puN mm/rmap.c~mm-page_state-opt mm/rmap.c
> --- devel/mm/rmap.c~mm-page_state-opt   2005-12-13 22:25:01.000000000 -0800
> +++ devel-akpm/mm/rmap.c        2005-12-13 22:25:01.000000000 -0800
> @@ -451,7 +451,11 @@ static void __page_set_anon_rmap(struct 
> 
>         page->index = linear_page_index(vma, address);
>  
> -       inc_page_state(nr_mapped);
> +       /*
> +        * nr_mapped state can be updated without turning off
> +        * interrupts because it is not modified via interrupt.
> +        */
> +       __inc_page_state(nr_mapped);
>  }
> 
> And since "nr_mapped" is not a counter for debugging purposes only, you 
> can't be lazy with reference to its consistency.
> 
> I would argue that you need a preempt save version for this important
> counters, surrounded by preempt_disable/preempt_enable (which vanish 
> if one selects !CONFIG_PREEMPT).
> 

I think it should not be racy because the function should always be
called with the page table lock held, which disables preempt. I guess
the comment should be explicit about that as well.

There were some runtime warnings that come up when this patch first
went into -mm because of a silly typo, however that should now be
resolved too.

> As Christoph notes, debugging counter consistency can be lazy, not even
> requiring correct preempt locking (hum, this is debatable, needs careful
> verification).
>  
> > So I'm not exactly sure why such a patch as this is wanted now? Are there
> > any more xxx_page_state hotspots? (I admit to only looking at page faults,
> > page allocator, and page reclaim).
> 
> A consolidation of the good parts of both would be interesting.
> 
> I don't see much point in Christoph's naming change to "event_counter", 
> why are you doing that?
> 
> And follows an addition to your's mm-page_state-opt-docs.patch. Still
> need to verify "nr_dirty" and "nr_unstable".
> 
> Happy new year!
> 

Thanks, happy new year to you too!

-- 
SUSE Labs, Novell Inc.



Send instant messages to your online friends http://au.messenger.yahoo.com 

  parent reply	other threads:[~2006-01-03  5:01 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-20 23:57 [RFC] Event counters [1/3]: Basic counter functionality Christoph Lameter
2005-12-20 23:57 ` [RFC] Event counters [2/3]: Convert inc_page_state -> count_event Christoph Lameter
2005-12-20 23:57 ` [RFC] Event counters [3/3]: Convert NUMA counters to event counters Christoph Lameter
2005-12-21 22:24   ` Christoph Lameter
2005-12-31  6:46 ` [RFC] Event counters [1/3]: Basic counter functionality Marcelo Tosatti
2005-12-31  7:54   ` Nick Piggin
2005-12-31 20:26     ` Marcelo Tosatti
2006-01-02 21:40       ` Marcelo Tosatti
2006-01-03  5:11         ` Nick Piggin
2006-01-03 10:11           ` Marcelo Tosatti
2006-01-03 13:21             ` Nick Piggin
2006-01-03 12:06               ` Marcelo Tosatti
2006-01-03  5:01       ` Nick Piggin [this message]
2006-01-03 19:08     ` Christoph Lameter

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=1136264464.5261.23.camel@npiggin-nld.site \
    --to=nickpiggin@yahoo.com.au \
    --cc=ak@suse.de \
    --cc=clameter@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    /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).