linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Lameter <clameter@engr.sgi.com>
To: Marcelo Tosatti <marcelo.tosatti@cyclades.com>
Cc: linux-kernel@vger.kernel.org, akpm@osdl.org,
	Hugh Dickins <hugh@veritas.com>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	linux-mm@kvack.org, Andi Kleen <ak@suse.de>
Subject: Re: [RFC3 02/14] Basic counter functionality
Date: Mon, 19 Dec 2005 09:58:09 -0800 (PST)	[thread overview]
Message-ID: <Pine.LNX.4.62.0512190954580.20292@schroedinger.engr.sgi.com> (raw)
In-Reply-To: <20051217040115.GA6975@dmt.cnet>

On Sat, 17 Dec 2005, Marcelo Tosatti wrote:

> > +static inline s8 *diff_pointer(struct zone *zone, enum zone_stat_item item)
> > +{
> > +	return &zone_pcp(zone, raw_smp_processor_id())->vm_stat_diff[item];
> > +}
> > +
> > +/*
> > + * For use when we know that interrupts are disabled.
> > + */
> > +void __mod_zone_page_state(struct zone *zone, enum zone_stat_item item, int delta)
> > +{
> > +	s8 *p;
> > +	long x;
> > +
> > +	p = diff_pointer(zone, item);
> > +	x = delta + *p;
> > +
> > +	if (unlikely(x > STAT_THRESHOLD || x < -STAT_THRESHOLD)) {
> > +		zone_page_state_consolidate(x, zone, item);
> > +		x = 0;
> > +	}
> > +
> > +	*p = x;
> > +}
> 
> There is no need to disable interrupts AFAICS, but only preemption
> (which could cause problems as your comment above describes). I suppose
> that these counters are not accessed at interrupt time and are not meant
> to be, right?

Some of the counters can be accessed at interrupt time and these are meant 
to be right. Next rev adds another racy version of the counters that will 
be used for the optional VM counters. Those counters will benefit from 
inc/dec if generated by the compiler.

> Why not use preempt_disable/preempt_enable? Those would disappear
> if !CONFIG_PREEMPT, and could be faster than the interrupt
> disabling/enabling (no need to save "flags" on stack, but increment
> preempt count, which has a chance to be on cache, I guess).

On a counter by counter basis one could use the __ functions that do not 
disable interrupts.

> It would also be nice to have all code related to debugging only
> counters selectable at compile time, since it might not be interesting
> data for some scenarios (but unnecessary bloat) - seems that was the
> original intent by Andrew as you noted.

That will be part of the next rev that I am currently testing.

--
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>

  parent reply	other threads:[~2005-12-19 17:58 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-12-15  0:14 [RFC3 00/14] Zoned VM stats Christoph Lameter
2005-12-15  0:14 ` [RFC3 01/14] Add some consts for inlines in mm.h Christoph Lameter
2005-12-15  1:01   ` J.A. Magallon
2005-12-15  0:14 ` [RFC3 02/14] Basic counter functionality Christoph Lameter
2005-12-17  4:01   ` Marcelo Tosatti
2005-12-17  4:19     ` Marcelo Tosatti
2005-12-19 17:58     ` Christoph Lameter [this message]
2005-12-15  0:14 ` [RFC3 03/14] Convert nr_mapped Christoph Lameter
2005-12-15  0:14 ` [RFC3 04/14] Convert nr_pagecache Christoph Lameter
2005-12-15  0:14 ` [RFC3 05/14] Resurrect scan_control.may_swap Christoph Lameter
2005-12-15  0:14 ` [RFC3 06/14] Zone Reclaim Christoph Lameter
2005-12-15  0:14 ` [RFC3 07/14] Expanded node and zone statistics Christoph Lameter
2005-12-15  0:14 ` [RFC3 08/14] Convert nr_slab Christoph Lameter
2005-12-15  0:15 ` [RFC3 09/14] Convert nr_page_table Christoph Lameter
2005-12-15  0:15 ` [RFC3 10/14] Convert nr_dirty Christoph Lameter
2005-12-15  0:15 ` [RFC3 11/14] Convert nr_writeback Christoph Lameter
2005-12-15  0:15 ` [RFC3 12/14] Convert nr_unstable Christoph Lameter
2005-12-15  0:15 ` [RFC3 13/14] Remove get_page_state functions Christoph Lameter
2005-12-15  0:15 ` [RFC3 14/14] Remove wbs 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=Pine.LNX.4.62.0512190954580.20292@schroedinger.engr.sgi.com \
    --to=clameter@engr.sgi.com \
    --cc=ak@suse.de \
    --cc=akpm@osdl.org \
    --cc=hugh@veritas.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=marcelo.tosatti@cyclades.com \
    --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