All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails
@ 2018-12-29  6:25 Peng Wang
  2018-12-29 10:02 ` Pekka Enberg
  2019-01-02 21:43   ` David Rientjes
  0 siblings, 2 replies; 4+ messages in thread
From: Peng Wang @ 2018-12-29  6:25 UTC (permalink / raw)
  To: cl, penberg, rientjes, iamjoonsoo.kim, akpm
  Cc: linux-mm, linux-kernel, Peng Wang

new_slab_objects() will return immediately if freelist is not NULL.

         if (freelist)
                 return freelist;

One more assignment operation could be avoided.

Signed-off-by: Peng Wang <rocking@whu.edu.cn>
---
 mm/slub.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/slub.c b/mm/slub.c
index 36c0befeebd8..cf2ef4ababff 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2463,8 +2463,7 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
 		stat(s, ALLOC_SLAB);
 		c->page = page;
 		*pc = c;
-	} else
-		freelist = NULL;
+	}
 
 	return freelist;
 }
-- 
2.19.1


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

* Re: [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails
  2018-12-29  6:25 [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails Peng Wang
@ 2018-12-29 10:02 ` Pekka Enberg
  2019-01-02 21:43   ` David Rientjes
  1 sibling, 0 replies; 4+ messages in thread
From: Pekka Enberg @ 2018-12-29 10:02 UTC (permalink / raw)
  To: Peng Wang, cl, penberg, rientjes, iamjoonsoo.kim, akpm
  Cc: linux-mm, linux-kernel

On 29/12/2018 8.25, Peng Wang wrote:
> new_slab_objects() will return immediately if freelist is not NULL.
> 
>           if (freelist)
>                   return freelist;
> 
> One more assignment operation could be avoided.
> 
> Signed-off-by: Peng Wang <rocking@whu.edu.cn>

Reviewed-by: Pekka Enberg <penberg@kernel.org>

> ---
>   mm/slub.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 36c0befeebd8..cf2ef4ababff 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2463,8 +2463,7 @@ static inline void *new_slab_objects(struct kmem_cache *s, gfp_t flags,
>   		stat(s, ALLOC_SLAB);
>   		c->page = page;
>   		*pc = c;
> -	} else
> -		freelist = NULL;
> +	}
>   
>   	return freelist;
>   }
> 

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

* Re: [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails
@ 2019-01-02 21:43   ` David Rientjes
  0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2019-01-02 21:43 UTC (permalink / raw)
  To: Peng Wang; +Cc: cl, penberg, iamjoonsoo.kim, akpm, linux-mm, linux-kernel

On Sat, 29 Dec 2018, Peng Wang wrote:

> new_slab_objects() will return immediately if freelist is not NULL.
> 
>          if (freelist)
>                  return freelist;
> 
> One more assignment operation could be avoided.
> 
> Signed-off-by: Peng Wang <rocking@whu.edu.cn>

Acked-by: David Rientjes <rientjes@google.com>

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

* Re: [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails
@ 2019-01-02 21:43   ` David Rientjes
  0 siblings, 0 replies; 4+ messages in thread
From: David Rientjes @ 2019-01-02 21:43 UTC (permalink / raw)
  To: Peng Wang; +Cc: cl, penberg, iamjoonsoo.kim, akpm, linux-mm, linux-kernel

On Sat, 29 Dec 2018, Peng Wang wrote:

> new_slab_objects() will return immediately if freelist is not NULL.
> 
>          if (freelist)
>                  return freelist;
> 
> One more assignment operation could be avoided.
> 
> Signed-off-by: Peng Wang <rocking@whu.edu.cn>

Acked-by: David Rientjes <rientjes@google.com>


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

end of thread, other threads:[~2019-01-02 21:44 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-29  6:25 [PATCH] mm/slub.c: freelist is ensured to be NULL when new_slab() fails Peng Wang
2018-12-29 10:02 ` Pekka Enberg
2019-01-02 21:43 ` David Rientjes
2019-01-02 21:43   ` David Rientjes

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.