Skip to content

Commit

Permalink
cpumask: replace node_to_cpumask with cpumask_of_node.
Browse files Browse the repository at this point in the history
Impact: cleanup

node_to_cpumask (and the blecherous node_to_cpumask_ptr which
contained a declaration) are replaced now everyone implements
cpumask_of_node.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
  • Loading branch information
Rusty Russell committed Mar 13, 2009
1 parent c69fc56 commit a70f730
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 17 deletions.
2 changes: 1 addition & 1 deletion drivers/base/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ static struct sysdev_class node_class = {
static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
{
struct node *node_dev = to_node(dev);
node_to_cpumask_ptr(mask, node_dev->sysdev.id);
const struct cpumask *mask = cpumask_of_node(node_dev->sysdev.id);
int len;

/* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
Expand Down
3 changes: 1 addition & 2 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,9 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
node = dev_to_node(&dev->dev);
if (node >= 0) {
int cpu;
node_to_cpumask_ptr(nodecpumask, node);

get_online_cpus();
cpu = cpumask_any_and(nodecpumask, cpu_online_mask);
cpu = cpumask_any_and(cpumask_of_node(node), cpu_online_mask);
if (cpu < nr_cpu_ids)
error = work_on_cpu(cpu, local_pci_probe, &ddi);
else
Expand Down
6 changes: 1 addition & 5 deletions include/linux/topology.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@
#endif

#ifndef nr_cpus_node
#define nr_cpus_node(node) \
({ \
node_to_cpumask_ptr(__tmp__, node); \
cpus_weight(*__tmp__); \
})
#define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node))
#endif

#define for_each_node_with_cpus(node) \
Expand Down
6 changes: 3 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2134,7 +2134,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
int n, val;
int min_val = INT_MAX;
int best_node = -1;
node_to_cpumask_ptr(tmp, 0);
const struct cpumask *tmp = cpumask_of_node(0);

/* Use the local node if we haven't already */
if (!node_isset(node, *used_node_mask)) {
Expand All @@ -2155,8 +2155,8 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
val += (n < node);

/* Give preference to headless and unused nodes */
node_to_cpumask_ptr_next(tmp, n);
if (!cpus_empty(*tmp))
tmp = cpumask_of_node(n);
if (!cpumask_empty(tmp))
val += PENALTY_FOR_NODE_WITH_CPUS;

/* Slight preference for less loaded node */
Expand Down
2 changes: 1 addition & 1 deletion mm/quicklist.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ static unsigned long max_pages(unsigned long min_pages)
int node = numa_node_id();
struct zone *zones = NODE_DATA(node)->node_zones;
int num_cpus_on_node;
node_to_cpumask_ptr(cpumask_on_node, node);
const struct cpumask *cpumask_on_node = cpumask_of_node(node);

node_free_pages =
#ifdef CONFIG_ZONE_DMA
Expand Down
2 changes: 1 addition & 1 deletion mm/slab.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,7 @@ static void __cpuinit cpuup_canceled(long cpu)
struct kmem_cache *cachep;
struct kmem_list3 *l3 = NULL;
int node = cpu_to_node(cpu);
node_to_cpumask_ptr(mask, node);
const struct cpumask *mask = cpumask_of_node(node);

list_for_each_entry(cachep, &cache_chain, next) {
struct array_cache *nc;
Expand Down
6 changes: 4 additions & 2 deletions mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1963,7 +1963,7 @@ static int kswapd(void *p)
struct reclaim_state reclaim_state = {
.reclaimed_slab = 0,
};
node_to_cpumask_ptr(cpumask, pgdat->node_id);
const struct cpumask *cpumask = cpumask_of_node(pgdat->node_id);

if (!cpumask_empty(cpumask))
set_cpus_allowed_ptr(tsk, cpumask);
Expand Down Expand Up @@ -2198,7 +2198,9 @@ static int __devinit cpu_callback(struct notifier_block *nfb,
if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
for_each_node_state(nid, N_HIGH_MEMORY) {
pg_data_t *pgdat = NODE_DATA(nid);
node_to_cpumask_ptr(mask, pgdat->node_id);
const struct cpumask *mask;

mask = cpumask_of_node(pgdat->node_id);

if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids)
/* One of our CPUs online: restore mask */
Expand Down
3 changes: 1 addition & 2 deletions net/sunrpc/svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -317,8 +317,7 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
}
case SVC_POOL_PERNODE:
{
node_to_cpumask_ptr(nodecpumask, node);
set_cpus_allowed_ptr(task, nodecpumask);
set_cpus_allowed_ptr(task, cpumask_of_node(node));
break;
}
}
Expand Down

0 comments on commit a70f730

Please sign in to comment.