All of lore.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH] mm: mempool: Optimize the mempool_create_node function
  2023-03-15 19:12 [PATCH] mm: mempool: Optimize the mempool_create_node function Li zeming
@ 2023-03-15 17:53 ` Florian Fainelli
  0 siblings, 0 replies; 2+ messages in thread
From: Florian Fainelli @ 2023-03-15 17:53 UTC (permalink / raw)
  To: Li zeming, akpm; +Cc: linux-mm, linux-kernel

On 3/15/23 12:12, Li zeming wrote:
> The pool pointer variable gets the kzalloc_node function return value
> directly at definition time, which should be more concise.
> 
> Signed-off-by: Li zeming <zeming@nfschina.com>

This looks pretty useless as a change, the generated code is going to be 
the same before/after, it is also not more readable, and it is 
definitively not an optimization in the sense that optimization should 
be used as meaning: the code is more efficient after that change.
-- 
Florian


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

* [PATCH] mm: mempool: Optimize the mempool_create_node function
@ 2023-03-15 19:12 Li zeming
  2023-03-15 17:53 ` Florian Fainelli
  0 siblings, 1 reply; 2+ messages in thread
From: Li zeming @ 2023-03-15 19:12 UTC (permalink / raw)
  To: akpm; +Cc: linux-mm, linux-kernel, Li zeming

The pool pointer variable gets the kzalloc_node function return value
directly at definition time, which should be more concise.

Signed-off-by: Li zeming <zeming@nfschina.com>
---
 mm/mempool.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/mm/mempool.c b/mm/mempool.c
index 734bcf5afbb7..9a4db6efc9ab 100644
--- a/mm/mempool.c
+++ b/mm/mempool.c
@@ -267,9 +267,7 @@ mempool_t *mempool_create_node(int min_nr, mempool_alloc_t *alloc_fn,
 			       mempool_free_t *free_fn, void *pool_data,
 			       gfp_t gfp_mask, int node_id)
 {
-	mempool_t *pool;
-
-	pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id);
+	mempool_t *pool = kzalloc_node(sizeof(*pool), gfp_mask, node_id);
 	if (!pool)
 		return NULL;
 
-- 
2.18.2


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

end of thread, other threads:[~2023-03-15 17:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 19:12 [PATCH] mm: mempool: Optimize the mempool_create_node function Li zeming
2023-03-15 17:53 ` Florian Fainelli

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.