Skip to content

Commit

Permalink
[PATCH] cpumask: add highest_possible_node_id
Browse files Browse the repository at this point in the history
cpumask: add highest_possible_node_id(), analogous to
highest_possible_processor_id().

[[email protected]: fix typo]
Signed-off-by: Greg Banks <[email protected]>
Signed-off-by: Paul Jackson <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Greg Banks authored and Linus Torvalds committed Oct 2, 2006
1 parent ca8af48 commit 0f532f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/linux/nodemask.h
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,15 @@ extern nodemask_t node_possible_map;
#define node_possible(node) node_isset((node), node_possible_map)
#define first_online_node first_node(node_online_map)
#define next_online_node(nid) next_node((nid), node_online_map)
int highest_possible_node_id(void);
#else
#define num_online_nodes() 1
#define num_possible_nodes() 1
#define node_online(node) ((node) == 0)
#define node_possible(node) ((node) == 0)
#define first_online_node 0
#define next_online_node(nid) (MAX_NUMNODES)
#define highest_possible_node_id() 0
#endif

#define any_online_node(mask) \
Expand Down
16 changes: 16 additions & 0 deletions lib/cpumask.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,19 @@ int __any_online_cpu(const cpumask_t *mask)
return cpu;
}
EXPORT_SYMBOL(__any_online_cpu);

#if MAX_NUMNODES > 1
/*
* Find the highest possible node id.
*/
int highest_possible_node_id(void)
{
unsigned int node;
unsigned int highest = 0;

for_each_node_mask(node, node_possible_map)
highest = node;
return highest;
}
EXPORT_SYMBOL(highest_possible_node_id);
#endif

0 comments on commit 0f532f3

Please sign in to comment.