mm, page_alloc: drop pointless static qualifier in build_zonelists()
Subsystems (2)
PATCH 1/1 mm, page_alloc: drop pointless static qualifier in build_zonelists()
There is no need to make the 'node_order' variable static since new value always be assigned before use it.
--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
mm/page_alloc.c +1 -1
@@ -5597,7 +5597,7 @@ static void build_thisnode_zonelists(pg_data_t *pgdat)static void build_zonelists (pg_data_t *pgdat) { -static int node_order[MAX_NUMNODES ]; +int node_order[MAX_NUMNODES ];int node, load, nr_nodes =0 ;nodemask_t used_mask;int local_node, prev_node;
Signature · 1 line
2.20.1
Quoted 15 lines · Kaitao Cheng
There is no need to make the '
node_order' variable static since new value always be assigned before use it.Signed-off-by Kaitao Cheng <[email protected]>Signed-off-by Muchun Song <[email protected]>--- mm/page_alloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)mm/page_alloc.c +0
-0
mm/page_alloc.c static void build_thisnode_zonelists(pg_data_t *pgdat) · line 5600
Quoted 5 lines
mm/page_alloc.c +1
-1@@ -5597,7 +5597,7 @@ static void build_thisnode_zonelists(pg_data_t *pgdat)static void build_zonelists (pg_data_t *pgdat) { -static int node_order[MAX_NUMNODES ]; +int node_order[MAX_NUMNODES ];
This isn't pointless. This prevents 4KB stack allocation which might overflow.
Quoted 2 lines · Kaitao Cheng
There is no need to make the '
node_order' variable static since new value always be assigned before use it.
In the past MAX_NUMMNODES could become quite large like 512 or 1k. Large array allocations on the stack are problematic.
Maybe that is no longer the case?
Quoted 9 lines · Cristopher Lameter
Quoted 2 lines · Kaitao Cheng
There is no need to make the '
node_order' variable static since new value always be assigned before use it.In the past
MAX_NUMMNODEScould become quite large like 512 or 1k. Large array allocations on the stack are problematic.Maybe that is no longer the case?
CONFIG_NODES_SHIFT=10 is nothing really unusual in distribution kernels. Likely wasteful for most HW available but a proper way to address it in this particular case is to use a different data structure than drop the static modifier which seems to be more of an misunderstanding than an intention.
Signature · 2 lines
Michal Hocko SUSE Labs