Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1433866

Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP

From David Vrabel <david.vrabel@citrix.com>
Newsgroups linux.kernel
Subject Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP
Date 2016-06-29 17:50 +0200
Message-ID <rPpUu-5Yx-7@gated-at.bofh.it> (permalink)
References <rPphL-5KQ-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH] x86/xen: Use DIV_ROUND_UP Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2016-06-29 17:10 +0200
  Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP Juergen Gross <jgross@suse.com> - 2016-06-29 17:40 +0200
  Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP "Jan Beulich" <JBeulich@suse.com> - 2016-06-29 17:40 +0200
  Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP David Vrabel <david.vrabel@citrix.com> - 2016-06-29 17:50 +0200

csiph-web