[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] Re: [PATCH 1 of 5] xentrace: fix t_info_pages calculation for the default case



On Wed, 2011-03-23 at 17:54 +0000, Olaf Hering wrote:
> -    t_info_pages = num_online_cpus() * pages + t_info_first_offset;
> -    t_info_pages *= sizeof(uint32_t);
> -    t_info_pages /= PAGE_SIZE;
> -    if ( t_info_pages % PAGE_SIZE )
> -        t_info_pages++;
> +    t_info_bytes = num_online_cpus() * pages + t_info_first_offset;
> +    t_info_bytes *= sizeof(uint32_t);
> +    t_info_pages = PFN_UP(t_info_bytes);

Hmm, still not quite following the spirit of the idea -- that
t_info_bytes should be bytes, not words (as it is in the first
instance).  I think I'd prefer making it one assignment:

    t_info_bytes = ( num_online_cpus() * pages + t_info_first_offset )
                     * sizeof(uint32_t);

But if you don't like that, to keep consistent, we should do this:
    t_info_words = num_online_cpus() * pages + t_info_first_offset;
    t_info_bytes = t_info_words * sizeof(uint32_t);
    t_info_pages = PFN_UP(t_info_bytes);
 
Then it's really clear when looking at it what the inputs and outputs of
each line is supposed to be.

 -George


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.