Re: [PATCH 1/2] mm/page_alloc.c: leverage compiler to zero out used_mask
From: Wei Yang
Date: Fri Mar 27 2020 - 09:27:27 EST
On Thu, Mar 26, 2020 at 07:36:04PM -0300, Jason Gunthorpe wrote:
>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@xxxxxxxxx>
>> 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.
>
Thanks for your comment. I think David found a better solution.
>Jason
--
Wei Yang
Help you, Help me