[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5773ECFC.3000407@citrix.com>
Date: Wed, 29 Jun 2016 16:45:00 +0100
From: David Vrabel <david.vrabel@...rix.com>
To: Amitoj Kaur Chawla <amitoj1606@...il.com>,
<boris.ostrovsky@...cle.com>, <david.vrabel@...rix.com>,
<jgross@...e.com>, <tglx@...utronix.de>, <mingo@...hat.com>,
<hpa@...or.com>, <x86@...nel.org>,
<xen-devel@...ts.xenproject.org>, <linux-kernel@...r.kernel.org>
CC: <julia.lawall@...6.fr>
Subject: Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP
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
Powered by blists - more mailing lists