[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v2 04/16] xen/x86: p2m-pod: Fix coding style





On 04/10/17 06:38, Jan Beulich wrote:
Julien Grall <julien.grall@xxxxxxx> 09/28/17 9:30 PM >>>
On 09/22/2017 10:15 AM, Jan Beulich wrote:
On 21.09.17 at 14:40, <julien.grall@xxxxxxx> wrote:
Also take the opportunity to:
      - move from 1 << * to 1UL << *.
      - use unsigned when possible
      - move from unsigned int -> unsigned long for some induction
      variables

I don't understand this last point, btw - the largest order page the
code needs to deal with right now is 1Gb, so there's no risk of
overflow (yet). But you've got George's and Andrew's ack, so no
need to revise this...

The last one result from the existing 1UL << in the code. We have place
where the induction variable is unsigned int but the shift unsigned long.

In which case I would have suggested to change the shift to use 1U, since ...
Looking at "<< order" within Xen we seems to use a mix of 1UL <<, 1U <<, 1 <<. The variant 1UL << seems to be predominant.

At the end we really want to be consistent with the rest of the code base.

Similarly the code is using a mix of 1 << and 1UL <<. I moved to UL
because even if the code only support up to 1GB superpage at the moment,
it would be pain to find all the places the day we decide to use bigger one.

... I doubt this would be too hard. But in the end it's George to judge anyway.

order is the number of MFN that is unsigned long and therefore would make sense to use 1UL <<. So I am not sure why you are pushing for 1U << here...

Cheers,

--
Julien Grall

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.