Rev 6934 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6934 | Rev 6936 | ||
---|---|---|---|
Line 83... | Line 83... | ||
83 | * optimization - don't waste any instructions or memory references |
83 | * optimization - don't waste any instructions or memory references |
84 | * asking if you're online or how many CPUs there are if there is |
84 | * asking if you're online or how many CPUs there are if there is |
85 | * only one CPU. |
85 | * only one CPU. |
86 | */ |
86 | */ |
Line 87... | Line 87... | ||
87 | 87 | ||
88 | extern const struct cpumask *const cpu_possible_mask; |
88 | extern struct cpumask __cpu_possible_mask; |
89 | extern const struct cpumask *const cpu_online_mask; |
89 | extern struct cpumask __cpu_online_mask; |
90 | extern const struct cpumask *const cpu_present_mask; |
90 | extern struct cpumask __cpu_present_mask; |
- | 91 | extern struct cpumask __cpu_active_mask; |
|
- | 92 | #define cpu_possible_mask ((const struct cpumask *)&__cpu_possible_mask) |
|
- | 93 | #define cpu_online_mask ((const struct cpumask *)&__cpu_online_mask) |
|
- | 94 | #define cpu_present_mask ((const struct cpumask *)&__cpu_present_mask) |
|
Line 91... | Line 95... | ||
91 | extern const struct cpumask *const cpu_active_mask; |
95 | #define cpu_active_mask ((const struct cpumask *)&__cpu_active_mask) |
92 | 96 | ||
93 | #if NR_CPUS > 1 |
97 | #if NR_CPUS > 1 |
94 | #define num_online_cpus() cpumask_weight(cpu_online_mask) |
98 | #define num_online_cpus() cpumask_weight(cpu_online_mask) |
Line 554... | Line 558... | ||
554 | * Returns -errno, or 0 for success. |
558 | * Returns -errno, or 0 for success. |
555 | */ |
559 | */ |
556 | static inline int cpumask_parse_user(const char __user *buf, int len, |
560 | static inline int cpumask_parse_user(const char __user *buf, int len, |
557 | struct cpumask *dstp) |
561 | struct cpumask *dstp) |
558 | { |
562 | { |
559 | return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
563 | return bitmap_parse_user(buf, len, cpumask_bits(dstp), nr_cpu_ids); |
560 | } |
564 | } |
Line 561... | Line 565... | ||
561 | 565 | ||
562 | /** |
566 | /** |
563 | * cpumask_parselist_user - extract a cpumask from a user string |
567 | * cpumask_parselist_user - extract a cpumask from a user string |
Line 569... | Line 573... | ||
569 | */ |
573 | */ |
570 | static inline int cpumask_parselist_user(const char __user *buf, int len, |
574 | static inline int cpumask_parselist_user(const char __user *buf, int len, |
571 | struct cpumask *dstp) |
575 | struct cpumask *dstp) |
572 | { |
576 | { |
573 | return bitmap_parselist_user(buf, len, cpumask_bits(dstp), |
577 | return bitmap_parselist_user(buf, len, cpumask_bits(dstp), |
574 | nr_cpumask_bits); |
578 | nr_cpu_ids); |
575 | } |
579 | } |
Line 576... | Line 580... | ||
576 | 580 | ||
577 | /** |
581 | /** |
578 | * cpumask_parse - extract a cpumask from from a string |
582 | * cpumask_parse - extract a cpumask from from a string |
Line 584... | Line 588... | ||
584 | static inline int cpumask_parse(const char *buf, struct cpumask *dstp) |
588 | static inline int cpumask_parse(const char *buf, struct cpumask *dstp) |
585 | { |
589 | { |
586 | char *nl = strchr(buf, '\n'); |
590 | char *nl = strchr(buf, '\n'); |
587 | unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf); |
591 | unsigned int len = nl ? (unsigned int)(nl - buf) : strlen(buf); |
Line 588... | Line 592... | ||
588 | 592 | ||
589 | return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpumask_bits); |
593 | return bitmap_parse(buf, len, cpumask_bits(dstp), nr_cpu_ids); |
Line 590... | Line 594... | ||
590 | } |
594 | } |
591 | 595 | ||
592 | /** |
596 | /** |
Line 596... | Line 600... | ||
596 | * |
600 | * |
597 | * Returns -errno, or 0 for success. |
601 | * Returns -errno, or 0 for success. |
598 | */ |
602 | */ |
599 | static inline int cpulist_parse(const char *buf, struct cpumask *dstp) |
603 | static inline int cpulist_parse(const char *buf, struct cpumask *dstp) |
600 | { |
604 | { |
601 | return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpumask_bits); |
605 | return bitmap_parselist(buf, cpumask_bits(dstp), nr_cpu_ids); |
602 | } |
606 | } |
Line 603... | Line 607... | ||
603 | 607 | ||
604 | /** |
608 | /** |
605 | * cpumask_size - size to allocate for a 'struct cpumask' in bytes |
609 | * cpumask_size - size to allocate for a 'struct cpumask' in bytes |
Line 714... | Line 718... | ||
714 | #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) |
718 | #define for_each_possible_cpu(cpu) for_each_cpu((cpu), cpu_possible_mask) |
715 | #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) |
719 | #define for_each_online_cpu(cpu) for_each_cpu((cpu), cpu_online_mask) |
716 | #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) |
720 | #define for_each_present_cpu(cpu) for_each_cpu((cpu), cpu_present_mask) |
Line 717... | Line 721... | ||
717 | 721 | ||
718 | /* Wrappers for arch boot code to manipulate normally-constant masks */ |
- | |
719 | void set_cpu_possible(unsigned int cpu, bool possible); |
- | |
720 | void set_cpu_present(unsigned int cpu, bool present); |
- | |
721 | void set_cpu_online(unsigned int cpu, bool online); |
- | |
722 | void set_cpu_active(unsigned int cpu, bool active); |
722 | /* Wrappers for arch boot code to manipulate normally-constant masks */ |
723 | void init_cpu_present(const struct cpumask *src); |
723 | void init_cpu_present(const struct cpumask *src); |
724 | void init_cpu_possible(const struct cpumask *src); |
724 | void init_cpu_possible(const struct cpumask *src); |
Line -... | Line 725... | ||
- | 725 | void init_cpu_online(const struct cpumask *src); |
|
- | 726 | ||
- | 727 | static inline void |
|
- | 728 | set_cpu_possible(unsigned int cpu, bool possible) |
|
- | 729 | { |
|
- | 730 | if (possible) |
|
- | 731 | cpumask_set_cpu(cpu, &__cpu_possible_mask); |
|
- | 732 | else |
|
- | 733 | cpumask_clear_cpu(cpu, &__cpu_possible_mask); |
|
- | 734 | } |
|
- | 735 | ||
- | 736 | static inline void |
|
- | 737 | set_cpu_present(unsigned int cpu, bool present) |
|
- | 738 | { |
|
- | 739 | if (present) |
|
- | 740 | cpumask_set_cpu(cpu, &__cpu_present_mask); |
|
- | 741 | else |
|
- | 742 | cpumask_clear_cpu(cpu, &__cpu_present_mask); |
|
- | 743 | } |
|
- | 744 | ||
- | 745 | static inline void |
|
- | 746 | set_cpu_online(unsigned int cpu, bool online) |
|
- | 747 | { |
|
- | 748 | if (online) { |
|
- | 749 | cpumask_set_cpu(cpu, &__cpu_online_mask); |
|
- | 750 | cpumask_set_cpu(cpu, &__cpu_active_mask); |
|
- | 751 | } else { |
|
- | 752 | cpumask_clear_cpu(cpu, &__cpu_online_mask); |
|
- | 753 | } |
|
- | 754 | } |
|
- | 755 | ||
- | 756 | static inline void |
|
- | 757 | set_cpu_active(unsigned int cpu, bool active) |
|
- | 758 | { |
|
- | 759 | if (active) |
|
- | 760 | cpumask_set_cpu(cpu, &__cpu_active_mask); |
|
- | 761 | else |
|
- | 762 | cpumask_clear_cpu(cpu, &__cpu_active_mask); |
|
- | 763 | } |
|
725 | void init_cpu_online(const struct cpumask *src); |
764 | |
726 | 765 | ||
727 | /** |
766 | /** |
728 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * |
767 | * to_cpumask - convert an NR_CPUS bitmap to a struct cpumask * |
729 | * @bitmap: the bitmap |
768 | * @bitmap: the bitmap |