Messages in this thread | | | Subject | Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP | From | David Vrabel <> | Date | Wed, 29 Jun 2016 16:45:00 +0100 |
| |
On 29/06/16 16:00, Amitoj Kaur Chawla wrote: > The kernel.h macro DIV_ROUND_UP performs the computation > (((n) + (d) - 1) /(d)) but is perhaps more readable. > > The Coccinelle script used to make this change is as follows: > @haskernel@ > @@ > > #include <linux/kernel.h> > > @depends on haskernel@ > expression n,d; > @@ > > ( > - (n + d - 1) / d > + DIV_ROUND_UP(n,d) > | > - (n + (d - 1)) / d > + DIV_ROUND_UP(n,d) > )
Applied to for-linus-4.8, thanks.
PFN_UP/DOWN() are for converting addresses to PFNs. DIV_ROUND_UP() is clearer when converting sizes to numbers of pages (as demonstrated by the incorrect suggestion to use PFN_DOWN()).
David
| |