public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Rusty Russell <rusty@rustcorp.com.au>
To: William Lee Irwin III <wli@holomorphy.com>
Cc: Andrew Morton <akpm@osdl.org>, John Hawkes <hawkes@sgi.com>,
	Ray Bryant <raybry@sgi.com>, Jesse Barnes <jbarnes@engr.sgi.com>,
	lkml - Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [profile] fix timer interrupt livelock on 512x Altix
Date: Fri, 15 Oct 2004 11:46:22 +1000	[thread overview]
Message-ID: <1097804782.22673.56.camel@localhost.localdomain> (raw)
In-Reply-To: <20040920213020.GX9106@holomorphy.com>

On Tue, 2004-09-21 at 07:30, William Lee Irwin III wrote:
> +static void __profile_flip_buffers(void *unused)
> +{
> +	int cpu = smp_processor_id();
> +
> +	per_cpu(cpu_profile_flip, cpu) = !per_cpu(cpu_profile_flip, cpu);
> +}

Please: one point of per-cpu vars is that archs can choose to hold the
per-cpu offset in a reg, and derive smp_processor_id() from that.  By
doing the reverse, manually, you defeat this.  How about:

	int *flip = __get_cpu_var(cpu_profile_flip);
	*flip = !*flip;

> +
> +static void profile_flip_buffers(void)
> +{
> +	int i, j, cpu;
> +
> +	down(&profile_flip_mutex);
> +	j = per_cpu(cpu_profile_flip, get_cpu());
> +	put_cpu();

Similarly, this is equivalent to:
	j = __get_cpu_var(cpu_profile_flip);

Cheers,
Rusty.
-- 
Anyone who quotes me in their signature is an idiot -- Rusty Russell


  parent reply	other threads:[~2004-10-15  1:46 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-20 21:30 [profile] fix timer interrupt livelock on 512x Altix William Lee Irwin III
2004-09-21  5:15 ` Andrew Morton
2004-09-21  8:42   ` William Lee Irwin III
2004-09-23  2:08     ` William Lee Irwin III
2004-10-15  1:46 ` Rusty Russell [this message]
2004-10-15 10:43   ` William Lee Irwin III

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=1097804782.22673.56.camel@localhost.localdomain \
    --to=rusty@rustcorp.com.au \
    --cc=akpm@osdl.org \
    --cc=hawkes@sgi.com \
    --cc=jbarnes@engr.sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=raybry@sgi.com \
    --cc=wli@holomorphy.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