Palacios Public Git Repository

To checkout Palacios execute

  git clone http://v3vee.org/palacios/palacios.web/palacios.git
This will give you the master branch. You probably want the devel branch or one of the release branches. To switch to the devel branch, simply execute
  cd palacios
  git checkout --track -b devel origin/devel
The other branches are similar.


Merge branch 'devel'
[palacios.git] / kitten / lib / cpumask.c
1 #include <lwk/kernel.h>
2 #include <lwk/bitops.h>
3 #include <lwk/cpumask.h>
4
5 int __first_cpu(const cpumask_t *srcp)
6 {
7         return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS));
8 }
9
10 int __next_cpu(int n, const cpumask_t *srcp)
11 {
12         return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1));
13 }
14
15 /*
16  * Find the highest possible smp_cpu_id()
17  *
18  * Note: if we're prepared to assume that cpu_possible_map never changes
19  * (reasonable) then this function should cache its return value.
20  */
21 int highest_possible_cpu_id(void)
22 {
23         unsigned int cpu;
24         unsigned highest = 0;
25
26         for_each_cpu_mask(cpu, cpu_present_map)
27                 highest = cpu;
28         return highest;
29 }
30
31 int __any_online_cpu(const cpumask_t *mask)
32 {
33         int cpu;
34
35         for_each_cpu_mask(cpu, *mask) {
36                 if (cpu_online(cpu))
37                         break;
38         }
39         return cpu;
40 }