[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200326223604.GP20941@ziepe.ca>
Date: Thu, 26 Mar 2020 19:36:04 -0300
From: Jason Gunthorpe <jgg@...pe.ca>
To: Wei Yang <richard.weiyang@...il.com>
Cc: akpm@...ux-foundation.org, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] mm/page_alloc.c: leverage compiler to zero out
used_mask
On Thu, Mar 26, 2020 at 10:24:44PM +0000, Wei Yang wrote:
> Since we always clear used_mask before getting node order, we can
> leverage compiler to do this instead of at run time.
>
> Signed-off-by: Wei Yang <richard.weiyang@...il.com>
> mm/page_alloc.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index 0e823bca3f2f..2144b6ceb119 100644
> +++ b/mm/page_alloc.c
> @@ -5587,14 +5587,13 @@ static void build_zonelists(pg_data_t *pgdat)
> {
> static int node_order[MAX_NUMNODES];
> int node, load, nr_nodes = 0;
> - nodemask_t used_mask;
> + nodemask_t used_mask = {.bits = {0}};
If this style is to be done it should just be '= {}';
This case demonstrates why the popular '= {0}' idiom is not such a
good idea, as it only works if the first member is an integral type.
Jason
Powered by blists - more mailing lists