mirror of
https://github.com/adulau/aha.git
synced 2024-12-29 04:06:22 +00:00
cpumask: replace node_to_cpumask with cpumask_of_node.
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>
This commit is contained in:
parent
c69fc56de1
commit
a70f730282
8 changed files with 13 additions and 17 deletions
|
@ -24,7 +24,7 @@ static struct sysdev_class node_class = {
|
||||||
static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
|
static ssize_t node_read_cpumap(struct sys_device *dev, int type, char *buf)
|
||||||
{
|
{
|
||||||
struct node *node_dev = to_node(dev);
|
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;
|
int len;
|
||||||
|
|
||||||
/* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
|
/* 2008/04/07: buf currently PAGE_SIZE, need 9 chars per 32 bits. */
|
||||||
|
|
|
@ -212,10 +212,9 @@ static int pci_call_probe(struct pci_driver *drv, struct pci_dev *dev,
|
||||||
node = dev_to_node(&dev->dev);
|
node = dev_to_node(&dev->dev);
|
||||||
if (node >= 0) {
|
if (node >= 0) {
|
||||||
int cpu;
|
int cpu;
|
||||||
node_to_cpumask_ptr(nodecpumask, node);
|
|
||||||
|
|
||||||
get_online_cpus();
|
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)
|
if (cpu < nr_cpu_ids)
|
||||||
error = work_on_cpu(cpu, local_pci_probe, &ddi);
|
error = work_on_cpu(cpu, local_pci_probe, &ddi);
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,11 +38,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef nr_cpus_node
|
#ifndef nr_cpus_node
|
||||||
#define nr_cpus_node(node) \
|
#define nr_cpus_node(node) cpumask_weight(cpumask_of_node(node))
|
||||||
({ \
|
|
||||||
node_to_cpumask_ptr(__tmp__, node); \
|
|
||||||
cpus_weight(*__tmp__); \
|
|
||||||
})
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define for_each_node_with_cpus(node) \
|
#define for_each_node_with_cpus(node) \
|
||||||
|
|
|
@ -2134,7 +2134,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
|
||||||
int n, val;
|
int n, val;
|
||||||
int min_val = INT_MAX;
|
int min_val = INT_MAX;
|
||||||
int best_node = -1;
|
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 */
|
/* Use the local node if we haven't already */
|
||||||
if (!node_isset(node, *used_node_mask)) {
|
if (!node_isset(node, *used_node_mask)) {
|
||||||
|
@ -2155,8 +2155,8 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
|
||||||
val += (n < node);
|
val += (n < node);
|
||||||
|
|
||||||
/* Give preference to headless and unused nodes */
|
/* Give preference to headless and unused nodes */
|
||||||
node_to_cpumask_ptr_next(tmp, n);
|
tmp = cpumask_of_node(n);
|
||||||
if (!cpus_empty(*tmp))
|
if (!cpumask_empty(tmp))
|
||||||
val += PENALTY_FOR_NODE_WITH_CPUS;
|
val += PENALTY_FOR_NODE_WITH_CPUS;
|
||||||
|
|
||||||
/* Slight preference for less loaded node */
|
/* Slight preference for less loaded node */
|
||||||
|
|
|
@ -29,7 +29,7 @@ static unsigned long max_pages(unsigned long min_pages)
|
||||||
int node = numa_node_id();
|
int node = numa_node_id();
|
||||||
struct zone *zones = NODE_DATA(node)->node_zones;
|
struct zone *zones = NODE_DATA(node)->node_zones;
|
||||||
int num_cpus_on_node;
|
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 =
|
node_free_pages =
|
||||||
#ifdef CONFIG_ZONE_DMA
|
#ifdef CONFIG_ZONE_DMA
|
||||||
|
|
|
@ -1160,7 +1160,7 @@ static void __cpuinit cpuup_canceled(long cpu)
|
||||||
struct kmem_cache *cachep;
|
struct kmem_cache *cachep;
|
||||||
struct kmem_list3 *l3 = NULL;
|
struct kmem_list3 *l3 = NULL;
|
||||||
int node = cpu_to_node(cpu);
|
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) {
|
list_for_each_entry(cachep, &cache_chain, next) {
|
||||||
struct array_cache *nc;
|
struct array_cache *nc;
|
||||||
|
|
|
@ -1963,7 +1963,7 @@ static int kswapd(void *p)
|
||||||
struct reclaim_state reclaim_state = {
|
struct reclaim_state reclaim_state = {
|
||||||
.reclaimed_slab = 0,
|
.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))
|
if (!cpumask_empty(cpumask))
|
||||||
set_cpus_allowed_ptr(tsk, cpumask);
|
set_cpus_allowed_ptr(tsk, cpumask);
|
||||||
|
@ -2198,7 +2198,9 @@ static int __devinit cpu_callback(struct notifier_block *nfb,
|
||||||
if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
|
if (action == CPU_ONLINE || action == CPU_ONLINE_FROZEN) {
|
||||||
for_each_node_state(nid, N_HIGH_MEMORY) {
|
for_each_node_state(nid, N_HIGH_MEMORY) {
|
||||||
pg_data_t *pgdat = NODE_DATA(nid);
|
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)
|
if (cpumask_any_and(cpu_online_mask, mask) < nr_cpu_ids)
|
||||||
/* One of our CPUs online: restore mask */
|
/* One of our CPUs online: restore mask */
|
||||||
|
|
|
@ -317,8 +317,7 @@ svc_pool_map_set_cpumask(struct task_struct *task, unsigned int pidx)
|
||||||
}
|
}
|
||||||
case SVC_POOL_PERNODE:
|
case SVC_POOL_PERNODE:
|
||||||
{
|
{
|
||||||
node_to_cpumask_ptr(nodecpumask, node);
|
set_cpus_allowed_ptr(task, cpumask_of_node(node));
|
||||||
set_cpus_allowed_ptr(task, nodecpumask);
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue