All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Make more redeable the kmalloc function
@ 2019-06-04  1:44 Emmanuel Arias
  2019-06-04 11:48 ` Matthew Wilcox
  0 siblings, 1 reply; 2+ messages in thread
From: Emmanuel Arias @ 2019-06-04  1:44 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm
  Cc: linux-mm, emmanuelarias30, Emmanuel Arias

The ``if```check of size > KMALLOC_MAX_CACHE_SIZE was between the same
preprocessor directive. I join the the directives to be more redeable.

Signed-off-by: Emmanuel Arias <eamanu@eamanu.com>
---
 include/linux/slab.h | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/include/linux/slab.h b/include/linux/slab.h
index 11b45f7ae405..90753231c191 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -531,12 +531,10 @@ static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
 static __always_inline void *kmalloc(size_t size, gfp_t flags)
 {
 	if (__builtin_constant_p(size)) {
-#ifndef CONFIG_SLOB
-		unsigned int index;
-#endif
 		if (size > KMALLOC_MAX_CACHE_SIZE)
 			return kmalloc_large(size, flags);
 #ifndef CONFIG_SLOB
+		unsigned int index;
 		index = kmalloc_index(size);
 
 		if (!index)
-- 
2.11.0


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

* Re: [PATCH] Make more redeable the kmalloc function
  2019-06-04  1:44 [PATCH] Make more redeable the kmalloc function Emmanuel Arias
@ 2019-06-04 11:48 ` Matthew Wilcox
  0 siblings, 0 replies; 2+ messages in thread
From: Matthew Wilcox @ 2019-06-04 11:48 UTC (permalink / raw)
  To: Emmanuel Arias
  Cc: cl, penberg, rientjes, iamjoonsoo.kim, akpm, linux-mm, emmanuelarias30

On Mon, Jun 03, 2019 at 10:44:54PM -0300, Emmanuel Arias wrote:
> The ``if```check of size > KMALLOC_MAX_CACHE_SIZE was between the same
> preprocessor directive. I join the the directives to be more redeable.

>  static __always_inline void *kmalloc(size_t size, gfp_t flags)
>  {
>  	if (__builtin_constant_p(size)) {
> -#ifndef CONFIG_SLOB
> -		unsigned int index;
> -#endif
>  		if (size > KMALLOC_MAX_CACHE_SIZE)
>  			return kmalloc_large(size, flags);
>  #ifndef CONFIG_SLOB
> +		unsigned int index;
>  		index = kmalloc_index(size);

You didn't get a new warning from -Wdeclaration-after-statement?


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

end of thread, other threads:[~2019-06-04 11:48 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-04  1:44 [PATCH] Make more redeable the kmalloc function Emmanuel Arias
2019-06-04 11:48 ` Matthew Wilcox

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.