提交 a64a26e8 编写于 作者: K KOSAKI Motohiro 提交者: Linus Torvalds

cpumask: add cpumask_var_t documentation

cpumask_var_t has one notable difference from cpumask_t.  Add the
explanation.
Signed-off-by: NKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 37e7b5f1
...@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void) ...@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
* ... use 'tmpmask' like a normal struct cpumask * ... * ... use 'tmpmask' like a normal struct cpumask * ...
* *
* free_cpumask_var(tmpmask); * free_cpumask_var(tmpmask);
*
*
* However, one notable exception is there. alloc_cpumask_var() allocates
* only nr_cpumask_bits bits (in the other hand, real cpumask_t always has
* NR_CPUS bits). Therefore you don't have to dereference cpumask_var_t.
*
* cpumask_var_t tmpmask;
* if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
* return -ENOMEM;
*
* var = *tmpmask;
*
* This code makes NR_CPUS length memcopy and brings to a memory corruption.
* cpumask_copy() provide safe copy functionality.
*/ */
#ifdef CONFIG_CPUMASK_OFFSTACK #ifdef CONFIG_CPUMASK_OFFSTACK
typedef struct cpumask *cpumask_var_t; typedef struct cpumask *cpumask_var_t;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册