From: Andrew Morton <akpm@linux-foundation.org>
To: "David J. Wilder" <dwilder@us.ibm.com>
Cc: linux-kernel@vger.kernel.org, systemtap@sourceware.org,
Andy Whitcroft <apw@shadowen.org>
Subject: Re: [patch 1/3] Relay Reset Consumed
Date: Wed, 5 Mar 2008 14:12:29 -0800 [thread overview]
Message-ID: <20080305141229.d79d846b.akpm@linux-foundation.org> (raw)
In-Reply-To: <1204588311.32186.7.camel@lc4eb748232119.ibm.com>
On Mon, 03 Mar 2008 15:51:50 -0800
"David J. Wilder" <dwilder@us.ibm.com> wrote:
> This patch allows relay channels to be reset i.e. unconsumed.
> Basically allows a 'rewind' function for flight-recorder tracing.
>
> +void relay_reset_consumed(struct rchan *chan)
> +{
> + unsigned int i;
> + struct rchan_buf *prev = NULL;
> +
> + if (!chan)
> + return;
> +
> + for (i = 0; i < NR_CPUS; i++) {
Use of NR_CPUS is usually wrong. In this case it seems you should be using
for_each_possible_cpu().
Also the existing usage of NR_CPUS in relay_subbufs_consumed() should be
switched to using cpu_possible().
New usage of NR_CPUS might be checkpatch-worthy, actually:
akpm:/usr/src/25> grep -l '^+.*NR_CPUS' patches/*.patch
patches/ext4-mm-mballoc-core.patch
patches/git-kvm.patch
patches/git-perfmon.patch
patches/relay-reset-consumed.patch
patches/x86-andi-git-x86.patch
patches/x86-andi-smp-switch-optimize.patch
that's a sample of 1852 patches.
An appropriate warning would be "Usage of NR_CPUS is often wrong - should
you be using cpu_possible(), num_possible_cpus(), for_each_possible_cpu(),
etc?".
next prev parent reply other threads:[~2008-03-05 22:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-03 23:51 [patch 1/3] Relay Reset Consumed David J. Wilder
2008-03-05 22:12 ` Andrew Morton [this message]
2008-03-06 10:56 ` Andy Whitcroft
-- strict thread matches above, loose matches on Subject: below --
2008-02-26 22:38 David J. Wilder
2007-11-13 1:02 David J. Wilder
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=20080305141229.d79d846b.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=apw@shadowen.org \
--cc=dwilder@us.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=systemtap@sourceware.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