All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Jan Beulich" <JBeulich@suse.com>
To: xen-devel <xen-devel@lists.xenproject.org>
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	Wei Liu <wei.liu2@citrix.com>,
	George Dunlap <George.Dunlap@eu.citrix.com>,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Ian Jackson <Ian.Jackson@eu.citrix.com>, Tim Deegan <tim@xen.org>
Subject: [PATCH 7/8] gnttab: use DIV_ROUND_UP() instead of open-coding it
Date: Tue, 15 Aug 2017 08:42:06 -0600	[thread overview]
Message-ID: <5993245E020000780016FF18@prv-mh.provo.novell.com> (raw)
In-Reply-To: <59931E0F020000780016FEA3@prv-mh.provo.novell.com>

Also adjust formatting of nearby code.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/xen/common/grant_table.c
+++ b/xen/common/grant_table.c
@@ -206,11 +206,13 @@ static inline void gnttab_flush_tlb(cons
 static inline unsigned int
 num_act_frames_from_sha_frames(const unsigned int num)
 {
-    /* How many frames are needed for the active grant table,
-     * given the size of the shared grant table? */
+    /*
+     * How many frames are needed for the active grant table,
+     * given the size of the shared grant table?
+     */
     unsigned int sha_per_page = PAGE_SIZE / sizeof(grant_entry_v1_t);
-    unsigned int num_sha_entries = num * sha_per_page;
-    return (num_sha_entries + (ACGNT_PER_PAGE - 1)) / ACGNT_PER_PAGE;
+
+    return DIV_ROUND_UP(num * sha_per_page, ACGNT_PER_PAGE);
 }
 
 #define max_nr_active_grant_frames \




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

  parent reply	other threads:[~2017-08-15 14:42 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-15 14:15 [PATCH 0/8] gnttab: recent XSA follow-up Jan Beulich
2017-08-15 14:38 ` [PATCH RESEND 1/8] gnttab: drop useless locking Jan Beulich
2017-08-15 16:08   ` Andrew Cooper
2017-08-15 14:39 ` [PATCH RESEND 2/8] gnttab: avoid spurious maptrack handle allocation failures Jan Beulich
2017-08-15 16:52   ` Andrew Cooper
2017-08-15 14:40 ` [PATCH 3/8] gnttab: type adjustments Jan Beulich
2017-08-15 17:04   ` Andrew Cooper
2017-08-15 14:40 ` [PATCH 4/8] gnttab: drop pointless leading double underscores Jan Beulich
2017-08-15 17:09   ` Andrew Cooper
2017-08-15 14:41 ` [PATCH 5/8] gnttab: re-arrange struct active_grant_entry Jan Beulich
2017-08-15 17:12   ` Andrew Cooper
2017-08-15 14:41 ` [PATCH 6/8] gnttab: move GNTPIN_* out of header file Jan Beulich
2017-08-15 17:14   ` Andrew Cooper
2017-08-16  6:54     ` Jan Beulich
2017-08-15 14:42 ` Jan Beulich [this message]
2017-08-15 17:15   ` [PATCH 7/8] gnttab: use DIV_ROUND_UP() instead of open-coding it Andrew Cooper
2017-08-15 14:42 ` [PATCH 8/8] gnttab: drop struct active_grant_entry's gfn field for release builds Jan Beulich
2017-08-15 17:18   ` Andrew Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5993245E020000780016FF18@prv-mh.provo.novell.com \
    --to=jbeulich@suse.com \
    --cc=George.Dunlap@eu.citrix.com \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=tim@xen.org \
    --cc=wei.liu2@citrix.com \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.