* [PATCH v2] cpumask: add cpumask_var_t documentation
@ 2011-04-28 15:27 KOSAKI Motohiro
2011-04-28 15:33 ` Thiago Farina
0 siblings, 1 reply; 5+ messages in thread
From: KOSAKI Motohiro @ 2011-04-28 15:27 UTC (permalink / raw)
To: LKML, Andrew Morton; +Cc: kosaki.motohiro
cpumask_var_t has one nortable difference against cpumask_t.
This patch adds the explanation.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
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 1e40dd0..471c98a 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
* ... use 'tmpmask' like a normal struct cpumask * ...
*
* free_cpumask_var(tmpmask);
+ *
+ *
+ * However, one notable exception is there. cpumask_var_t is allocated
+ * only nr_cpu_ids 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 bring memroy corruption.
+ * You have to use cpumask_copy() instead.
*/
#ifdef CONFIG_CPUMASK_OFFSTACK
typedef struct cpumask *cpumask_var_t;
--
1.7.3.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v2] cpumask: add cpumask_var_t documentation
2011-04-28 15:27 [PATCH v2] cpumask: add cpumask_var_t documentation KOSAKI Motohiro
@ 2011-04-28 15:33 ` Thiago Farina
2011-04-28 15:43 ` [PATCH v3] " KOSAKI Motohiro
0 siblings, 1 reply; 5+ messages in thread
From: Thiago Farina @ 2011-04-28 15:33 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: LKML, Andrew Morton
On Thu, Apr 28, 2011 at 12:27 PM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
> cpumask_var_t has one nortable difference against cpumask_t.
> This patch adds the explanation.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
> 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 1e40dd0..471c98a 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
> * ... use 'tmpmask' like a normal struct cpumask * ...
> *
> * free_cpumask_var(tmpmask);
> + *
> + *
> + * However, one notable exception is there. cpumask_var_t is allocated
> + * only nr_cpu_ids bits
Maybe, instead of "is allocated only", "allocates only" ?
> (in the other hand, real cpumask_t always has
> + * NR_CPUS bits). therefore You don't have to dereference cpumask_var_t.
s/therefore You/Therefore you/ ?
> + *
> + * cpumask_var_t tmpmask;
> + * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
> + * return -ENOMEM;
> + *
> + * var = *tmpmask;
> + *
> + * This code makes NR_CPUS length memcopy and bring memroy corruption.
/s/memroy/memory
You are saying that I should not use this code? I'm confused, could
you explain a little bit?
> + * You have to use cpumask_copy() instead.
> */
I don't get this. :(
> #ifdef CONFIG_CPUMASK_OFFSTACK
> typedef struct cpumask *cpumask_var_t;
> --
> 1.7.3.1
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v3] cpumask: add cpumask_var_t documentation
2011-04-28 15:33 ` Thiago Farina
@ 2011-04-28 15:43 ` KOSAKI Motohiro
2011-04-28 15:48 ` Thiago Farina
0 siblings, 1 reply; 5+ messages in thread
From: KOSAKI Motohiro @ 2011-04-28 15:43 UTC (permalink / raw)
To: Thiago Farina; +Cc: kosaki.motohiro, LKML, Andrew Morton
> On Thu, Apr 28, 2011 at 12:27 PM, KOSAKI Motohiro
> <kosaki.motohiro@jp.fujitsu.com> wrote:
> > cpumask_var_t has one nortable difference against cpumask_t.
> > This patch adds the explanation.
> >
> > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> > ---
> > 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 1e40dd0..471c98a 100644
> > --- a/include/linux/cpumask.h
> > +++ b/include/linux/cpumask.h
> > @@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
> > * ... use 'tmpmask' like a normal struct cpumask * ...
> > *
> > * free_cpumask_var(tmpmask);
> > + *
> > + *
> > + * However, one notable exception is there. cpumask_var_t is allocated
> > + * only nr_cpu_ids bits
>
> Maybe, instead of "is allocated only", "allocates only" ?
Instead, "alloc_cpumask_var() allocates only nr_cpu_ids bits" is more clear? :)
> > (in the other hand, real cpumask_t always has
> > + * NR_CPUS bits). therefore You don't have to dereference cpumask_var_t.
>
> s/therefore You/Therefore you/ ?
>
Thx.
> > + *
> > + * cpumask_var_t tmpmask;
> > + * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
> > + * return -ENOMEM;
> > + *
> > + * var = *tmpmask;
> > + *
> > + * This code makes NR_CPUS length memcopy and bring memroy corruption.
>
> /s/memroy/memory
>
> You are saying that I should not use this code? I'm confused, could
> you explain a little bit?
Yes. you aren't confused.
> > + * You have to use cpumask_copy() instead.
> > */
>
> I don't get this. :(
"cpumask_copy() privide safe copy functionality." is clear?
>From d2ea9d4846e46bcc8a82b9a641ede3a10aca346c Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Tue, 26 Apr 2011 19:58:39 +0900
Subject: [PATCH v3] cpumask: add cpumask_var_t documentation
cpumask_var_t has one nortable difference against cpumask_t.
This patch adds the explanation.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
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 1e40dd0..e2b9032 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
* ... use 'tmpmask' like a normal struct cpumask * ...
*
* 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 bring memory corruption.
+ * cpumask_copy() privide safe copy functionality.
*/
#ifdef CONFIG_CPUMASK_OFFSTACK
typedef struct cpumask *cpumask_var_t;
--
1.7.3.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v3] cpumask: add cpumask_var_t documentation
2011-04-28 15:43 ` [PATCH v3] " KOSAKI Motohiro
@ 2011-04-28 15:48 ` Thiago Farina
2011-04-28 15:52 ` [PATCH v4] " KOSAKI Motohiro
0 siblings, 1 reply; 5+ messages in thread
From: Thiago Farina @ 2011-04-28 15:48 UTC (permalink / raw)
To: KOSAKI Motohiro; +Cc: LKML, Andrew Morton
On Thu, Apr 28, 2011 at 12:43 PM, KOSAKI Motohiro
<kosaki.motohiro@jp.fujitsu.com> wrote:
>> On Thu, Apr 28, 2011 at 12:27 PM, KOSAKI Motohiro
>> <kosaki.motohiro@jp.fujitsu.com> wrote:
>> > cpumask_var_t has one nortable difference against cpumask_t.
>> > This patch adds the explanation.
>> >
>> > Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
>> > ---
>> > 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 1e40dd0..471c98a 100644
>> > --- a/include/linux/cpumask.h
>> > +++ b/include/linux/cpumask.h
>> > @@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
>> > * ... use 'tmpmask' like a normal struct cpumask * ...
>> > *
>> > * free_cpumask_var(tmpmask);
>> > + *
>> > + *
>> > + * However, one notable exception is there. cpumask_var_t is allocated
>> > + * only nr_cpu_ids bits
>>
>> Maybe, instead of "is allocated only", "allocates only" ?
>
> Instead, "alloc_cpumask_var() allocates only nr_cpu_ids bits" is more clear? :)
>
Yup. Thx.
>
>> > (in the other hand, real cpumask_t always has
>> > + * NR_CPUS bits). therefore You don't have to dereference cpumask_var_t.
>>
>> s/therefore You/Therefore you/ ?
>>
>
> Thx.
>
>
>> > + *
>> > + * cpumask_var_t tmpmask;
>> > + * if (!alloc_cpumask_var(&tmpmask, GFP_KERNEL))
>> > + * return -ENOMEM;
>> > + *
>> > + * var = *tmpmask;
>> > + *
>> > + * This code makes NR_CPUS length memcopy and bring memroy corruption.
>>
>> /s/memroy/memory
>>
>> You are saying that I should not use this code? I'm confused, could
>> you explain a little bit?
>
> Yes. you aren't confused.
>
>
>> > + * You have to use cpumask_copy() instead.
>> > */
>>
>> I don't get this. :(
>
> "cpumask_copy() privide safe copy functionality." is clear?
>
Yes. ;)
>
> From d2ea9d4846e46bcc8a82b9a641ede3a10aca346c Mon Sep 17 00:00:00 2001
> From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> Date: Tue, 26 Apr 2011 19:58:39 +0900
> Subject: [PATCH v3] cpumask: add cpumask_var_t documentation
>
> cpumask_var_t has one nortable difference against cpumask_t.
> This patch adds the explanation.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
> ---
> 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 1e40dd0..e2b9032 100644
> --- a/include/linux/cpumask.h
> +++ b/include/linux/cpumask.h
> @@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
> * ... use 'tmpmask' like a normal struct cpumask * ...
> *
> * 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 bring memory corruption.
Maybe:
s/bring memory/brings to a memory/
?
> + * cpumask_copy() privide safe copy functionality.
s/privide/provides ?
> */
> #ifdef CONFIG_CPUMASK_OFFSTACK
> typedef struct cpumask *cpumask_var_t;
> --
> 1.7.3.1
>
>
>
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v4] cpumask: add cpumask_var_t documentation
2011-04-28 15:48 ` Thiago Farina
@ 2011-04-28 15:52 ` KOSAKI Motohiro
0 siblings, 0 replies; 5+ messages in thread
From: KOSAKI Motohiro @ 2011-04-28 15:52 UTC (permalink / raw)
To: Thiago Farina; +Cc: kosaki.motohiro, LKML, Andrew Morton
> > + * This code makes NR_CPUS length memcopy and bring memory corruption.
>
> Maybe:
>
> s/bring memory/brings to a memory/
>
> ?
>
> > + * cpumask_copy() privide safe copy functionality.
> s/privide/provides ?
Thank you.
>From 28549f1a51072a58bd661a409e378e36a97072a3 Mon Sep 17 00:00:00 2001
From: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Date: Tue, 26 Apr 2011 19:58:39 +0900
Subject: [PATCH v4] cpumask: add cpumask_var_t documentation
cpumask_var_t has one nortable difference against cpumask_t.
This patch adds the explanation.
Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
---
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 1e40dd0..8fcd82c 100644
--- a/include/linux/cpumask.h
+++ b/include/linux/cpumask.h
@@ -617,6 +617,20 @@ static inline size_t cpumask_size(void)
* ... use 'tmpmask' like a normal struct cpumask * ...
*
* 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
typedef struct cpumask *cpumask_var_t;
--
1.7.3.1
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-04-28 15:52 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-28 15:27 [PATCH v2] cpumask: add cpumask_var_t documentation KOSAKI Motohiro
2011-04-28 15:33 ` Thiago Farina
2011-04-28 15:43 ` [PATCH v3] " KOSAKI Motohiro
2011-04-28 15:48 ` Thiago Farina
2011-04-28 15:52 ` [PATCH v4] " KOSAKI Motohiro
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®