linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists()
@ 2019-09-27 16:14 Kaitao Cheng
  2019-09-27 19:32 ` Dan Williams
  2019-10-08 19:06 ` Christopher Lameter
  0 siblings, 2 replies; 4+ messages in thread
From: Kaitao Cheng @ 2019-09-27 16:14 UTC (permalink / raw)
  To: akpm
  Cc: sashal, mhocko, osalvador, mgorman, rppt, dan.j.williams,
	alexander.h.duyck, pavel.tatashin, glider, linux-mm,
	linux-kernel, Kaitao Cheng, Muchun Song

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 <pilgrimtao@gmail.com>
Signed-off-by: Muchun Song <smuchun@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 3334a769eb91..c473c304d09f 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -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;
-- 
2.20.1



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

* Re: [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists()
  2019-09-27 16:14 [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists() Kaitao Cheng
@ 2019-09-27 19:32 ` Dan Williams
  2019-10-08 19:06 ` Christopher Lameter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Williams @ 2019-09-27 19:32 UTC (permalink / raw)
  To: Kaitao Cheng
  Cc: Andrew Morton, Sasha Levin, Michal Hocko, Oscar Salvador,
	Mel Gorman, Mike Rapoport, Alexander Duyck, Pasha Tatashin,
	Alexander Potapenko, Linux MM, Linux Kernel Mailing List,
	Muchun Song

On Fri, Sep 27, 2019 at 9:14 AM Kaitao Cheng <pilgrimtao@gmail.com> wrote:
>
> 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 <pilgrimtao@gmail.com>
> Signed-off-by: Muchun Song <smuchun@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 3334a769eb91..c473c304d09f 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -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.


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

* Re: [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists()
  2019-09-27 16:14 [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists() Kaitao Cheng
  2019-09-27 19:32 ` Dan Williams
@ 2019-10-08 19:06 ` Christopher Lameter
  2019-10-08 19:21   ` Michal Hocko
  1 sibling, 1 reply; 4+ messages in thread
From: Christopher Lameter @ 2019-10-08 19:06 UTC (permalink / raw)
  To: Kaitao Cheng
  Cc: akpm, sashal, mhocko, osalvador, mgorman, rppt, dan.j.williams,
	alexander.h.duyck, pavel.tatashin, glider, linux-mm,
	linux-kernel, Muchun Song

On Sat, 28 Sep 2019, Kaitao Cheng wrote:

> 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?


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

* Re: [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists()
  2019-10-08 19:06 ` Christopher Lameter
@ 2019-10-08 19:21   ` Michal Hocko
  0 siblings, 0 replies; 4+ messages in thread
From: Michal Hocko @ 2019-10-08 19:21 UTC (permalink / raw)
  To: Christopher Lameter
  Cc: Kaitao Cheng, akpm, sashal, osalvador, mgorman, rppt,
	dan.j.williams, alexander.h.duyck, pavel.tatashin, glider,
	linux-mm, linux-kernel, Muchun Song

On Tue 08-10-19 19:06:57, Cristopher Lameter wrote:
> On Sat, 28 Sep 2019, Kaitao Cheng wrote:
> 
> > 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?

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.
-- 
Michal Hocko
SUSE Labs


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

end of thread, other threads:[~2019-10-08 19:21 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 16:14 [PATCH] mm, page_alloc: drop pointless static qualifier in build_zonelists() Kaitao Cheng
2019-09-27 19:32 ` Dan Williams
2019-10-08 19:06 ` Christopher Lameter
2019-10-08 19:21   ` Michal Hocko

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).