Re: [patch 1/3] Relay Reset Consumed

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Andrew Morton
Date: Wednesday, March 5, 2008 - 3:12 pm

On Mon, 03 Mar 2008 15:51:50 -0800
"David J. Wilder" <dwilder@us.ibm.com> wrote:


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?".

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[patch 1/3] Relay Reset Consumed, David J. Wilder, (Mon Mar 3, 4:51 pm)
Re: [patch 1/3] Relay Reset Consumed, Andrew Morton, (Wed Mar 5, 3:12 pm)
Re: [patch 1/3] Relay Reset Consumed, Andy Whitcroft, (Thu Mar 6, 3:56 am)