[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] gnttab: use DIV_ROUND_UP() instead of open-coding it
commit c98e9ec647df00a5726e00c93bd69a4d5a2d88e7 Author: Jan Beulich <jbeulich@xxxxxxxx> AuthorDate: Wed Aug 16 11:02:48 2017 +0200 Commit: Jan Beulich <jbeulich@xxxxxxxx> CommitDate: Wed Aug 16 11:02:48 2017 +0200 gnttab: use DIV_ROUND_UP() instead of open-coding it Also adjust formatting of nearby code. Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> --- xen/common/grant_table.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/xen/common/grant_table.c b/xen/common/grant_table.c index 5bfaf38..9506c02 100644 --- a/xen/common/grant_table.c +++ b/xen/common/grant_table.c @@ -206,11 +206,13 @@ static inline void gnttab_flush_tlb(const struct domain *d) 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 \ -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |