Commit f3344dc3 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] cpumask: rewrite cpumask.h - single bitmap based implementation

From: Paul Jackson <pj@sgi.com>

Major rewrite of cpumask to use a single implementation, as a struct-wrapped
bitmap.

This patch leaves some 26 include/asm-*/cpumask*.h header files orphaned - to
be removed next patch.

Some nine cpumask macros for const variants and to coerce and promote between
an unsigned long and a cpumask are obsolete.  Simple emulation wrappers are
provided in this patch for these obsolete macros, which can be removed once
each of the 3 archs (i386, ppc64, x86_64) using them are recoded in follow-on
patches to not need them.

The CPU_MASK_ALL macro now avoids leaving possible garbage one bits in any
unused portion of the high word.

An inproved comment lists all available operators, for convenient browsing.

From: Mikael Pettersson <mikpe@csd.uu.se>

  2.6.7-rc3-mm1 changed CPU_MASK_NONE into something that isn't a valid
  rvalue (it only works inside struct initializers).  This caused compile-time
  errors in perfctr in UP x86 builds.

From: Arnd Bergmann <arnd@arndb.de>

  cpumask-5-10-rewrite-cpumaskh-single-bitmap-based from 2.6.7-rc3-mm1
  causes include2/asm/smp.h:54:1: warning: "cpu_online" redefined
Signed-off-by: default avatarPaul Jackson <pj@sgi.com>
Signed-off-by: default avatarMikael Pettersson <mikpe@csd.uu.se>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d6cf71d3
......@@ -691,9 +691,10 @@ static inline void redirect_intr(int cpu, struct ino_bucket *bp)
* Just Do It.
*/
struct irqaction *ap = bp->irq_info;
cpumask_t cpu_mask = get_smpaff_in_irqaction(ap);
cpumask_t cpu_mask;
unsigned int buddy, ticks;
cpus_addr(cpu_mask)[0] = get_smpaff_in_irqaction(ap);
cpus_and(cpu_mask, cpu_mask, cpu_online_map);
if (cpus_empty(cpu_mask))
cpu_mask = cpu_online_map;
......@@ -1210,9 +1211,10 @@ static int irq_affinity_read_proc (char *page, char **start, off_t off,
{
struct ino_bucket *bp = ivector_table + (long)data;
struct irqaction *ap = bp->irq_info;
cpumask_t mask = get_smpaff_in_irqaction(ap);
cpumask_t mask;
int len;
cpus_addr(mask)[0] = get_smpaff_in_irqaction(ap);
if (cpus_empty(mask))
mask = cpu_online_map;
......
......@@ -31,10 +31,6 @@ typedef struct
extern int smp_call_function_on(void (*func) (void *info), void *info,
int nonatomic, int wait, int cpu);
extern cpumask_t cpu_online_map;
extern cpumask_t cpu_possible_map;
#define NO_PROC_ID 0xFF /* No processor magic marker */
/*
......@@ -51,8 +47,6 @@ extern cpumask_t cpu_possible_map;
#define smp_processor_id() (S390_lowcore.cpu_data.cpu_nr)
#define cpu_online(cpu) cpu_isset(cpu, cpu_online_map)
extern __inline__ __u16 hard_smp_processor_id(void)
{
__u16 cpu_address;
......
This diff is collapsed.
......@@ -129,17 +129,14 @@ static void rcu_do_batch(struct rcu_head *list)
*/
static void rcu_start_batch(int next_pending)
{
cpumask_t active;
if (next_pending)
rcu_ctrlblk.next_pending = 1;
if (rcu_ctrlblk.next_pending &&
rcu_ctrlblk.completed == rcu_ctrlblk.cur) {
/* Can't change, since spin lock held. */
active = nohz_cpu_mask;
cpus_complement(active);
cpus_and(rcu_state.rcu_cpu_mask, cpu_online_map, active);
cpus_andnot(rcu_state.rcu_cpu_mask, cpu_online_map,
nohz_cpu_mask);
write_seqcount_begin(&rcu_ctrlblk.lock);
rcu_ctrlblk.next_pending = 0;
rcu_ctrlblk.cur++;
......
......@@ -2951,6 +2951,11 @@ asmlinkage long sys_sched_setaffinity(pid_t pid, unsigned int len,
cpumask_t cpu_present_map;
EXPORT_SYMBOL(cpu_present_map);
#ifndef CONFIG_SMP
cpumask_t cpu_online_map = CPU_MASK_ALL;
cpumask_t cpu_possible_map = CPU_MASK_ALL;
#endif
/**
* sys_sched_getaffinity - get the cpu affinity of a process
* @pid: pid of the process
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment