mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
cpumask: Provide a generic set of CPUMASK_ALLOC macros
* Provide a generic set of CPUMASK_ALLOC macros patterned after the SCHED_CPUMASK_ALLOC macros. This is used where multiple cpumask_t variables are declared on the stack to reduce the amount of stack space required. Signed-off-by: Mike Travis <travis@sgi.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
4755b92912
commit
77586c2bda
@ -75,6 +75,17 @@
|
|||||||
* CPU_MASK_NONE Initializer - no bits set
|
* CPU_MASK_NONE Initializer - no bits set
|
||||||
* unsigned long *cpus_addr(mask) Array of unsigned long's in mask
|
* unsigned long *cpus_addr(mask) Array of unsigned long's in mask
|
||||||
*
|
*
|
||||||
|
*if NR_CPUS > BITS_PER_LONG
|
||||||
|
* CPUMASK_ALLOC(m) Declares and allocates struct m *m =
|
||||||
|
* (struct m *)kmalloc(sizeof(*m), ...)
|
||||||
|
* CPUMASK_FREE(m) Macro for kfree(v)
|
||||||
|
*else
|
||||||
|
* CPUMASK_ALLOC(m) Declares struct m _m, *m = &_m
|
||||||
|
* CPUMASK_FREE(m) Nop
|
||||||
|
*endif
|
||||||
|
* CPUMASK_VAR(v, m) Declares cpumask_t *v =
|
||||||
|
* m + offset(struct m, v)
|
||||||
|
*
|
||||||
* int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
|
* int cpumask_scnprintf(buf, len, mask) Format cpumask for printing
|
||||||
* int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
|
* int cpumask_parse_user(ubuf, ulen, mask) Parse ascii string as cpumask
|
||||||
* int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
|
* int cpulist_scnprintf(buf, len, mask) Format cpumask as list for printing
|
||||||
@ -311,6 +322,16 @@ extern cpumask_t cpu_mask_all;
|
|||||||
|
|
||||||
#define cpus_addr(src) ((src).bits)
|
#define cpus_addr(src) ((src).bits)
|
||||||
|
|
||||||
|
#if NR_CPUS > BITS_PER_LONG
|
||||||
|
#define CPUMASK_ALLOC(m) struct m *m = kmalloc(sizeof(*m), GFP_KERNEL)
|
||||||
|
#define CPUMASK_FREE(m) kfree(m)
|
||||||
|
#else
|
||||||
|
#define CPUMASK_ALLOC(m) struct allmasks _m, *m = &_m
|
||||||
|
#define CPUMASK_FREE(m)
|
||||||
|
#endif
|
||||||
|
#define CPUMASK_VAR(v, m) cpumask_t *v = (cpumask_t *) \
|
||||||
|
((unsigned long)(m) + offsetof(struct m, v))
|
||||||
|
|
||||||
#define cpumask_scnprintf(buf, len, src) \
|
#define cpumask_scnprintf(buf, len, src) \
|
||||||
__cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
|
__cpumask_scnprintf((buf), (len), &(src), NR_CPUS)
|
||||||
static inline int __cpumask_scnprintf(char *buf, int len,
|
static inline int __cpumask_scnprintf(char *buf, int len,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user