All of lore.kernel.org
 help / color / mirror / Atom feed
* [KJ] [PATCH] Use kzalloc
@ 2006-08-03 20:47 tom_hisch
  2006-08-03 21:12 ` Nishanth Aravamudan
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: tom_hisch @ 2006-08-03 20:47 UTC (permalink / raw)
  To: kernel-janitors

From: Thomas Hisch <t.hisch@gmail.com>

use kzalloc in include/asm-i386/thread_info.h instead of kmalloc + memset

Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
---
 include/asm-i386/thread_info.h |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)

diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 54d6d7a..a8f37f2 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -32,7 +32,6 @@ struct thread_info {
 	__u32			cpu;		/* current CPU */
 	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
 
-
 	mm_segment_t		addr_limit;	/* thread address space:
 					 	   0-0xBFFFFFFF for user-thead
 						   0-0xFFFFFFFF for kernel-thread
@@ -99,9 +98,7 @@ #define alloc_thread_info(tsk)					\
 	({							\
 		struct thread_info *ret;			\
 								\
-		ret = kmalloc(THREAD_SIZE, GFP_KERNEL);		\
-		if (ret)					\
-			memset(ret, 0, THREAD_SIZE);		\
+		ret = kzalloc(THREAD_SIZE, GFP_KERNEL);		\
 		ret;						\
 	})
 #else
-- 
1.4.2.rc1.gbc9e-dirty



_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH] Use kzalloc
  2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
@ 2006-08-03 21:12 ` Nishanth Aravamudan
  2006-08-03 21:29 ` Bernd Petrovitsch
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Nishanth Aravamudan @ 2006-08-03 21:12 UTC (permalink / raw)
  To: kernel-janitors

On 03.08.2006 [22:47:08 +0200], tom_hisch@gmx.at wrote:
> From: Thomas Hisch <t.hisch@gmail.com>
> 
> use kzalloc in include/asm-i386/thread_info.h instead of kmalloc + memset
> 
> Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
> ---
>  include/asm-i386/thread_info.h |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
> index 54d6d7a..a8f37f2 100644
> --- a/include/asm-i386/thread_info.h
> +++ b/include/asm-i386/thread_info.h
> @@ -32,7 +32,6 @@ struct thread_info {
>  	__u32			cpu;		/* current CPU */
>  	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
>  
> -
Looks like an unrelated change sneaked in.

Thanks,
Nish

>  	mm_segment_t		addr_limit;	/* thread address space:
>  					 	   0-0xBFFFFFFF for user-thead
>  						   0-0xFFFFFFFF for kernel-thread
> @@ -99,9 +98,7 @@ #define alloc_thread_info(tsk)					\
>  	({							\
>  		struct thread_info *ret;			\
>  								\
> -		ret = kmalloc(THREAD_SIZE, GFP_KERNEL);		\
> -		if (ret)					\
> -			memset(ret, 0, THREAD_SIZE);		\
> +		ret = kzalloc(THREAD_SIZE, GFP_KERNEL);		\
>  		ret;						\
>  	})
>  #else
> -- 
> 1.4.2.rc1.gbc9e-dirty
> 
> 
> 
> _______________________________________________
> Kernel-janitors mailing list
> Kernel-janitors@lists.osdl.org
> https://lists.osdl.org/mailman/listinfo/kernel-janitors
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH] Use kzalloc
  2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
  2006-08-03 21:12 ` Nishanth Aravamudan
@ 2006-08-03 21:29 ` Bernd Petrovitsch
  2006-08-07 10:50 ` tom_hisch
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Bernd Petrovitsch @ 2006-08-03 21:29 UTC (permalink / raw)
  To: kernel-janitors

On Thu, 2006-08-03 at 22:47 +0200, tom_hisch@gmx.at wrote:
> From: Thomas Hisch <t.hisch@gmail.com>
> 
> use kzalloc in include/asm-i386/thread_info.h instead of kmalloc + memset
> 
> Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
> ---
>  include/asm-i386/thread_info.h |    5 +----
>  1 files changed, 1 insertions(+), 4 deletions(-)
> 
> diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
> index 54d6d7a..a8f37f2 100644
> --- a/include/asm-i386/thread_info.h
> +++ b/include/asm-i386/thread_info.h
> @@ -32,7 +32,6 @@ struct thread_info {
>  	__u32			cpu;		/* current CPU */
>  	int			preempt_count;	/* 0 => preemptable, <0 => BUG */
>  
> -
>  	mm_segment_t		addr_limit;	/* thread address space:
>  					 	   0-0xBFFFFFFF for user-thead
>  						   0-0xFFFFFFFF for kernel-thread
> @@ -99,9 +98,7 @@ #define alloc_thread_info(tsk)					\
>  	({							\
>  		struct thread_info *ret;			\
>  								\
> -		ret = kmalloc(THREAD_SIZE, GFP_KERNEL);		\
> -		if (ret)					\
> -			memset(ret, 0, THREAD_SIZE);		\
> +		ret = kzalloc(THREAD_SIZE, GFP_KERNEL);		\
>  		ret;						\
>  	})
>  #else

which leaves
----  snip  ----
#define alloc_thread_info(tsk)				
 	({							\
		struct thread_info *ret;			\
								\
		ret = kzalloc(THREAD_SIZE, GFP_KERNEL);		\
		ret;						\
 	})
----  snip  ----
which is AFAICS equivalent to 
----  snip  ----
#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
----  snip  ----

	Bernd
-- 
Firmix Software GmbH                   http://www.firmix.at/
mobil: +43 664 4416156                 fax: +43 1 7890849-55
          Embedded Linux Development and Services

_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [KJ] [PATCH] Use kzalloc
  2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
  2006-08-03 21:12 ` Nishanth Aravamudan
  2006-08-03 21:29 ` Bernd Petrovitsch
@ 2006-08-07 10:50 ` tom_hisch
  2006-08-07 11:45 ` walter harms
  2006-08-13 11:00 ` tom hisch
  4 siblings, 0 replies; 6+ messages in thread
From: tom_hisch @ 2006-08-07 10:50 UTC (permalink / raw)
  To: kernel-janitors

From: Thomas Hisch <t.hisch@gmail.com>

Replace kzalloc instead of kmalloc + memset.

Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
---
 include/asm-i386/thread_info.h |   10 +---------
 1 files changed, 1 insertions(+), 9 deletions(-)

diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
index 54d6d7a..46d32ad 100644
--- a/include/asm-i386/thread_info.h
+++ b/include/asm-i386/thread_info.h
@@ -95,15 +95,7 @@ static inline struct thread_info *curren
 
 /* thread information allocation */
 #ifdef CONFIG_DEBUG_STACK_USAGE
-#define alloc_thread_info(tsk)					\
-	({							\
-		struct thread_info *ret;			\
-								\
-		ret = kmalloc(THREAD_SIZE, GFP_KERNEL);		\
-		if (ret)					\
-			memset(ret, 0, THREAD_SIZE);		\
-		ret;						\
-	})
+#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
 #else
 #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
 #endif
-- 
1.4.2.rc1.gf25b-dirty



_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [KJ] [PATCH] Use kzalloc
  2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
                   ` (2 preceding siblings ...)
  2006-08-07 10:50 ` tom_hisch
@ 2006-08-07 11:45 ` walter harms
  2006-08-13 11:00 ` tom hisch
  4 siblings, 0 replies; 6+ messages in thread
From: walter harms @ 2006-08-07 11:45 UTC (permalink / raw)
  To: kernel-janitors

hi thomas,
this patch results in:

#ifdef CONFIG_DEBUG_STACK_USAGE
#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
#else
#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
#endif

does it make sense to have two case ? the performance penalty should not 
matter if this is reduced to
#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
in any case. opinions ?

just my 2 cents,
  walter




tom_hisch@gmx.at wrote:
> From: Thomas Hisch <t.hisch@gmail.com>
> 
> Replace kzalloc instead of kmalloc + memset.
> 
> Signed-off-by: Thomas Hisch <t.hisch@gmail.com>
> ---
>  include/asm-i386/thread_info.h |   10 +---------
>  1 files changed, 1 insertions(+), 9 deletions(-)
> 
> diff --git a/include/asm-i386/thread_info.h b/include/asm-i386/thread_info.h
> index 54d6d7a..46d32ad 100644
> --- a/include/asm-i386/thread_info.h
> +++ b/include/asm-i386/thread_info.h
> @@ -95,15 +95,7 @@ static inline struct thread_info *curren
>  
>  /* thread information allocation */
>  #ifdef CONFIG_DEBUG_STACK_USAGE
> -#define alloc_thread_info(tsk)					\
> -	({							\
> -		struct thread_info *ret;			\
> -								\
> -		ret = kmalloc(THREAD_SIZE, GFP_KERNEL);		\
> -		if (ret)					\
> -			memset(ret, 0, THREAD_SIZE);		\
> -		ret;						\
> -	})
> +#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
>  #else
>  #define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
>  #endif
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [KJ] [PATCH] Use kzalloc
  2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
                   ` (3 preceding siblings ...)
  2006-08-07 11:45 ` walter harms
@ 2006-08-13 11:00 ` tom hisch
  4 siblings, 0 replies; 6+ messages in thread
From: tom hisch @ 2006-08-13 11:00 UTC (permalink / raw)
  To: kernel-janitors

walter harms wrote:
>hi thomas,
>this patch results in:
>
>#ifdef CONFIG_DEBUG_STACK_USAGE
>#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
>#else
>#define alloc_thread_info(tsk) kmalloc(THREAD_SIZE, GFP_KERNEL)
>#endif
>
>does it make sense to have two case ? the performance penalty should not
>matter if this is reduced to
>#define alloc_thread_info(tsk) kzalloc(THREAD_SIZE, GFP_KERNEL)
>in any case. opinions ?

yes, we could reduce it to kzalloc but why should we reduce it when a
zeroed allocation is not really needed in case of
CONFIG_DEBUG_STACK_USAGE is not set.  look at
include/asm-powerpc/thread_info.h there is the same defined
alloc_thread_info function (if THREAD_SHIFT < PAGE_SHIFT) as in my
patch.

maybe I'm totally wrong with my point of view, so please let me hear
your opinions.

thomas

>
>just my 2 cents,
>  walter
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2006-08-13 11:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-03 20:47 [KJ] [PATCH] Use kzalloc tom_hisch
2006-08-03 21:12 ` Nishanth Aravamudan
2006-08-03 21:29 ` Bernd Petrovitsch
2006-08-07 10:50 ` tom_hisch
2006-08-07 11:45 ` walter harms
2006-08-13 11:00 ` tom hisch

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.