From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753162AbcF2PpU (ORCPT ); Wed, 29 Jun 2016 11:45:20 -0400 Received: from smtp.citrix.com ([66.165.176.89]:25060 "EHLO SMTP.CITRIX.COM" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752851AbcF2PpR (ORCPT ); Wed, 29 Jun 2016 11:45:17 -0400 X-IronPort-AV: E=Sophos;i="5.26,547,1459814400"; d="scan'208";a="363501411" Subject: Re: [Xen-devel] [PATCH] x86/xen: Use DIV_ROUND_UP To: Amitoj Kaur Chawla , , , , , , , , , References: <20160629150038.GA13956@amitoj-Inspiron-3542> CC: From: David Vrabel Message-ID: <5773ECFC.3000407@citrix.com> Date: Wed, 29 Jun 2016 16:45:00 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Icedove/38.5.0 MIME-Version: 1.0 In-Reply-To: <20160629150038.GA13956@amitoj-Inspiron-3542> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-DLP: MIA1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > > @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