lkml.org 
[lkml]   [2020]   [Mar]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [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@gmail.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

\
 
 \ /
  Last update: 2020-03-26 23:37    [W:0.046 / U:7.688 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site