linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm/page_alloc.c: Clean code by removing unnecessary initialization
@ 2020-09-04 13:24 mateusznosek0
  2020-09-04 18:12 ` Andrew Morton
  0 siblings, 1 reply; 2+ messages in thread
From: mateusznosek0 @ 2020-09-04 13:24 UTC (permalink / raw)
  To: linux-mm, linux-kernel; +Cc: Mateusz Nosek, akpm

From: Mateusz Nosek <mateusznosek0@gmail.com>

Previously variable 'tmp' was initialized, but was not read later
before reassigning. So the initialization can be removed.

Signed-off-by: Mateusz Nosek <mateusznosek0@gmail.com>
---
 mm/page_alloc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 3ae4f3651aec..77c3d2084004 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -5637,7 +5637,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
 	int n, val;
 	int min_val = INT_MAX;
 	int best_node = NUMA_NO_NODE;
-	const struct cpumask *tmp = cpumask_of_node(0);
+	const struct cpumask *tmp;
 
 	/* Use the local node if we haven't already */
 	if (!node_isset(node, *used_node_mask)) {
-- 
2.20.1


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

* Re: [PATCH] mm/page_alloc.c: Clean code by removing unnecessary initialization
  2020-09-04 13:24 [PATCH] mm/page_alloc.c: Clean code by removing unnecessary initialization mateusznosek0
@ 2020-09-04 18:12 ` Andrew Morton
  0 siblings, 0 replies; 2+ messages in thread
From: Andrew Morton @ 2020-09-04 18:12 UTC (permalink / raw)
  To: mateusznosek0; +Cc: linux-mm, linux-kernel

On Fri,  4 Sep 2020 15:24:22 +0200 mateusznosek0@gmail.com wrote:

> From: Mateusz Nosek <mateusznosek0@gmail.com>
> 
> Previously variable 'tmp' was initialized, but was not read later
> before reassigning. So the initialization can be removed.
> 
> ...
>
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -5637,7 +5637,7 @@ static int find_next_best_node(int node, nodemask_t *used_node_mask)
>  	int n, val;
>  	int min_val = INT_MAX;
>  	int best_node = NUMA_NO_NODE;
> -	const struct cpumask *tmp = cpumask_of_node(0);
> +	const struct cpumask *tmp;
>  
>  	/* Use the local node if we haven't already */
>  	if (!node_isset(node, *used_node_mask)) {

OK.   But we may as well kill tmp altogether?

--- a/mm/page_alloc.c~mm-page_allocc-clean-code-by-removing-unnecessary-initialization-fix
+++ a/mm/page_alloc.c
@@ -5637,7 +5637,6 @@ static int find_next_best_node(int node,
 	int n, val;
 	int min_val = INT_MAX;
 	int best_node = NUMA_NO_NODE;
-	const struct cpumask *tmp;
 
 	/* Use the local node if we haven't already */
 	if (!node_isset(node, *used_node_mask)) {
@@ -5658,8 +5657,7 @@ static int find_next_best_node(int node,
 		val += (n < node);
 
 		/* Give preference to headless and unused nodes */
-		tmp = cpumask_of_node(n);
-		if (!cpumask_empty(tmp))
+		if (!cpumask_empty(cpumask_of_node(n)))
 			val += PENALTY_FOR_NODE_WITH_CPUS;
 
 		/* Slight preference for less loaded node */
_


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

end of thread, other threads:[~2020-09-04 18:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-04 13:24 [PATCH] mm/page_alloc.c: Clean code by removing unnecessary initialization mateusznosek0
2020-09-04 18:12 ` Andrew Morton

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).