linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Lezcano <daniel.lezcano@linaro.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: rjw@rjwysocki.net, ulf.hansson@linaro.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/3] genirq/timings: Add array suffix computation code
Date: Tue, 26 Mar 2019 16:22:59 +0100	[thread overview]
Message-ID: <5ad6f7d7-3081-8eef-1adf-3ce705a1ba94@linaro.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1903241825210.1798@nanos.tec.linutronix.de>


Hi Thomas,

thanks for reviewing this patch.

[ ... ]

>> +
>> +/*
>> + * Exponential moving average computation
>> + */
>> +static int irq_timings_ema_new(s64 value, s64 ema_old)
> 
> There is a mixed bag of s64/u64 all over this code. Please stay
> consistent. We had enough sign confusion bugs in the past.

Right.

I have a question, ema_old and value will be always u64 type and the
function irq_timings_ema_new() will return an u64 ...

> 	value = (value - ema_old) * EMA_ALPHA_VAL;
> 	return ema_old + value >> EMA_ALPHA_SHIFT;

... how can I deal with the operations above when value < ema_old ?

Shall I use an intermediate s64 ?

eg:

	s64 aux = (value - ema_old) * EMA_ALPHA_VAL;
	return ema_old + aux >> EMA_ALPHA_SHIFT;
?

[ ... ]

 > Other than that this looks good to me. Nice work!

Thanks, I appreciate.

-- 
 <http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro:  <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog


  reply	other threads:[~2019-03-26 15:23 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-08 21:20 [PATCH 0/3] IRQ next prediction and mbed governor Daniel Lezcano
2019-03-08 21:20 ` [PATCH 1/3] genirq/timings: Remove variance computation code Daniel Lezcano
2019-03-08 21:20 ` [PATCH 2/3] genirq/timings: Add array suffix " Daniel Lezcano
2019-03-24 17:44   ` Thomas Gleixner
2019-03-26 15:22     ` Daniel Lezcano [this message]
2019-03-26 16:04       ` Thomas Gleixner
2019-03-08 21:20 ` [PATCH 3/3] cpuidle/drivers/mbed: Add new governor for embedded systems Daniel Lezcano
2019-04-02 13:22   ` Quentin Perret
2019-04-02 16:02     ` Daniel Lezcano
2019-04-02 16:26       ` Quentin Perret

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5ad6f7d7-3081-8eef-1adf-3ce705a1ba94@linaro.org \
    --to=daniel.lezcano@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=rjw@rjwysocki.net \
    --cc=tglx@linutronix.de \
    --cc=ulf.hansson@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).