Re: [RFC PATCH 07/30] cputime: Convert kcpustat to nsecs

From: Martin Schwidefsky
Date: Mon Dec 01 2014 - 09:14:15 EST


On Fri, 28 Nov 2014 19:23:37 +0100
Frederic Weisbecker <fweisbec@xxxxxxxxx> wrote:

> Kernel cpu stats are stored in cputime_t which is an architecture
> defined type, and hence a bit opaque and requiring accessors and mutators
> for any operation.
>
> Converting them to nsecs simplifies the code a little bit.

Quite honestly I do not see much of an improvement here, on set of
functions (cputime_to_xxx) gets replaced by another (nsecs_to_xxx).

On the contrary for s390 I see a degradation, consider a hunk like
this:

> @@ -128,9 +128,9 @@ static inline u64 get_cpu_idle_time_jiffy(unsigned int cpu, u64 *wall)
>
> idle_time = cur_wall_time - busy_time;
> if (wall)
> - *wall = cputime_to_usecs(cur_wall_time);
> + *wall = div_u64(cur_wall_time, NSEC_PER_USEC);
>
> - return cputime_to_usecs(idle_time);
> + return div_u64(idle_time, NSEC_PER_USEC);
> }
>
> u64 get_cpu_idle_time(unsigned int cpu, u64 *wall, int io_busy)

For s390 cputime_to_usecs is a shift, with the new code we now have a division.
Fortunately this is in a piece of code that s390 does not use..

--
blue skies,
Martin.

"Reality continues to ruin my life." - Calvin.

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/