diff options
author | KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> | 2011-07-26 19:08:45 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-07-26 19:49:44 -0400 |
commit | a64a26e822ddb739de464540dfd2cbb6abce47d5 (patch) | |
tree | 95d8e783342d64c2c63d98ec5814b4405cab7370 | |
parent | 37e7b5f1535dddaace865b25df34a2d049a3a66f (diff) |
cpumask: add cpumask_var_t documentation
cpumask_var_t has one notable difference from cpumask_t. Add the
explanation.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | include/linux/cpumask.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index b24ac56477b4..4f7a63237471 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void) | |||
617 | * ... use 'tmpmask' like a normal struct cpumask * ... | 617 | * ... use 'tmpmask' like a normal struct cpumask * ... |
618 | * | 618 | * |
619 | * free_cpumask_var(tmpmask); | 619 | * free_cpumask_var(tmpmask); |
620 | * | ||
621 | * | ||
622 | * However, one notable exception is there. alloc_cpumask_var() allocates | ||
623 | * only nr_cpumask_bits bits (in the other hand, real cpumask_t always has | ||
624 | * NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t. | ||
625 | * | ||
626 | * cpumask_var_t tmpmask; | ||
627 | * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL)) | ||
628 | * return -ENOMEM; | ||
629 | * | ||
630 | * var = *tmpmask; | ||
631 | * | ||
632 | * This code makes NR_CPUS length memcopy and brings to a memory corruption. | ||
633 | * cpumask_copy() provide safe copy functionality. | ||
620 | */ | 634 | */ |
621 | #ifdef CONFIG_CPUMASK_OFFSTACK | 635 | #ifdef CONFIG_CPUMASK_OFFSTACK |
622 | typedef struct cpumask *cpumask_var_t; | 636 | typedef struct cpumask *cpumask_var_t; |