Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1459733 > unrolled thread
| Started by | Yuyang Du <yuyang.du@intel.com> |
|---|---|
| First post | 2016-08-10 22:00 +0200 |
| Last post | 2016-08-25 09:20 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[PATCH v1 07/10] sched/fair: Remove useless 64-bit to 32-bit variable conversion Yuyang Du <yuyang.du@intel.com> - 2016-08-10 22:00 +0200
Re: [PATCH v1 07/10] sched/fair: Remove useless 64-bit to 32-bit variable conversion Vincent Guittot <vincent.guittot@linaro.org> - 2016-08-25 09:20 +0200
| From | Yuyang Du <yuyang.du@intel.com> |
|---|---|
| Date | 2016-08-10 22:00 +0200 |
| Subject | [PATCH v1 07/10] sched/fair: Remove useless 64-bit to 32-bit variable conversion |
| Message-ID | <s4HPs-16w-13@gated-at.bofh.it> |
In __decay_sum(), the 64-bit to 32-bit variable conversion makes no
performance nor correctness use.
Minor cleanup and no functionality change.
Signed-off-by: Yuyang Du <yuyang.du@intel.com>
---
kernel/sched/fair.c | 13 ++++---------
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 283e2c2..eea3349 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -2616,16 +2616,11 @@ static const u32 __accumulated_sum_N32[] = {
*/
static __always_inline u64 __decay_sum(u64 val, u64 n)
{
- unsigned int local_n;
-
if (!n)
return val;
else if (unlikely(n > SCHED_AVG_HALFLIFE * 63))
return 0;
- /* after bounds checking we can collapse to 32-bit */
- local_n = n;
-
/*
* As y^HALFLIFE = 1/2, we can combine
* y^n = 1/2^(n/HALFLIFE) * y^(n%HALFLIFE)
@@ -2633,12 +2628,12 @@ static __always_inline u64 __decay_sum(u64 val, u64 n)
*
* To achieve constant time __decay_load.
*/
- if (unlikely(local_n >= SCHED_AVG_HALFLIFE)) {
- val >>= local_n / SCHED_AVG_HALFLIFE;
- local_n %= SCHED_AVG_HALFLIFE;
+ if (unlikely(n >= SCHED_AVG_HALFLIFE)) {
+ val >>= n / SCHED_AVG_HALFLIFE;
+ n %= SCHED_AVG_HALFLIFE;
}
- val = mul_u64_u32_shr(val, __decay_inv_multiply_N[local_n], 32);
+ val = mul_u64_u32_shr(val, __decay_inv_multiply_N[n], 32);
return val;
}
--
1.7.9.5
[toc] | [next] | [standalone]
| From | Vincent Guittot <vincent.guittot@linaro.org> |
|---|---|
| Date | 2016-08-25 09:20 +0200 |
| Subject | Re: [PATCH v1 07/10] sched/fair: Remove useless 64-bit to 32-bit variable conversion |
| Message-ID | <s9X7c-6ey-19@gated-at.bofh.it> |
| In reply to | #1459733 |
On 10 August 2016 at 02:14, Yuyang Du <yuyang.du@intel.com> wrote:
> In __decay_sum(), the 64-bit to 32-bit variable conversion makes no
> performance nor correctness use.
Are you sure that there is no impact on 32bits system ?
Even this will be mainly shift manipulation
>
> Minor cleanup and no functionality change.
>
> Signed-off-by: Yuyang Du <yuyang.du@intel.com>
> ---
> kernel/sched/fair.c | 13 ++++---------
> 1 file changed, 4 insertions(+), 9 deletions(-)
>
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 283e2c2..eea3349 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -2616,16 +2616,11 @@ static const u32 __accumulated_sum_N32[] = {
> */
> static __always_inline u64 __decay_sum(u64 val, u64 n)
> {
> - unsigned int local_n;
> -
> if (!n)
> return val;
> else if (unlikely(n > SCHED_AVG_HALFLIFE * 63))
> return 0;
>
> - /* after bounds checking we can collapse to 32-bit */
> - local_n = n;
> -
> /*
> * As y^HALFLIFE = 1/2, we can combine
> * y^n = 1/2^(n/HALFLIFE) * y^(n%HALFLIFE)
> @@ -2633,12 +2628,12 @@ static __always_inline u64 __decay_sum(u64 val, u64 n)
> *
> * To achieve constant time __decay_load.
> */
> - if (unlikely(local_n >= SCHED_AVG_HALFLIFE)) {
> - val >>= local_n / SCHED_AVG_HALFLIFE;
> - local_n %= SCHED_AVG_HALFLIFE;
> + if (unlikely(n >= SCHED_AVG_HALFLIFE)) {
> + val >>= n / SCHED_AVG_HALFLIFE;
> + n %= SCHED_AVG_HALFLIFE;
> }
>
> - val = mul_u64_u32_shr(val, __decay_inv_multiply_N[local_n], 32);
> + val = mul_u64_u32_shr(val, __decay_inv_multiply_N[n], 32);
> return val;
> }
>
> --
> 1.7.9.5
>
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web