lkml.org 
[lkml]   [2010]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/2] KVM: Remove unnecessary divide operations
On 07/01/2010 05:00 PM, Joerg Roedel wrote:
> This patch converts unnecessary divide and modulo operations
> in the KVM large page related code into logical operations.
> This allows to convert gfn_t to u64 while not breaking 32
> bit builds.
>
>
> #define KVM_NR_PAGE_SIZES 2
> -#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + ((x) - 1) * 8)
> +#define KVM_HPAGE_GFN_SHIFT(x) (((x) - 1) * 8)
> +#define KVM_HPAGE_SHIFT(x) (PAGE_SHIFT + KVM_HPAGE_GFN_SHIFT(x))
> #define KVM_HPAGE_SIZE(x) (1UL<< KVM_HPAGE_SHIFT(x))
> #define KVM_HPAGE_MASK(x) (~(KVM_HPAGE_SIZE(x) - 1))
>

In theory, KVM_HPAGE_SIZE() needs s/1UL/(u64)1/, or KVM_HPAGE_MASK
becomes truncated if used against a gfn_t. In practice, KVM_HPAGE_MASK
is not used at all, so this doesn't matter.

--
error compiling committee.c: too many arguments to function



\
 
 \ /
  Last update: 2010-07-01 16:21    [W:0.048 / U:0.368 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site