public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bruno Randolf <br1@einfach.org>
To: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Cc: randy.dunlap@oracle.com, akpm@linux-foundation.org,
	kevin.granade@gmail.com, Lars_Ericsson@telia.com,
	blp@cs.stanford.edu, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] Add generic exponentially weighted moving average (EWMA) function
Date: Fri, 22 Oct 2010 09:53:30 +0900	[thread overview]
Message-ID: <201010220953.30148.br1@einfach.org> (raw)
In-Reply-To: <20101021192658.C8EE.A69D9226@jp.fujitsu.com>

On Thu October 21 2010 19:31:47 KOSAKI Motohiro wrote:
> Hi
> 
> I'm plaing this a bit and I have to say this doesn't works as I expected
> because ewma_init() has very easy confusable.
> 
> so, I have one request.
> 
> > +/**
> > + * ewma_init() - Initialize EWMA parameters
> > + * @avg: Average structure
> > + * @factor: Factor to use for the scaled up internal value. The maximum
> > value + *	of averages can be UINT_MAX/(factor*weight).
> > + * @weight: Exponential weight, or decay rate. This defines how fast the
> > + * 	influence of older values decreases. Has to be bigger than 1.
> > + *
> > + * Initialize the EWMA parameters for a given struct ewma @avg.
> > + */
> > +struct ewma*
> > +ewma_init(struct ewma *avg, const unsigned int factor,
> > +	  const unsigned int weight)
> > +{
> > +	WARN_ON(weight <= 1 || factor == 0);
> > +	avg->weight = weight;
> > +	avg->factor = factor;
> > +	return avg;
> > +}
> > +EXPORT_SYMBOL(ewma_init);
> 
> Please initalize avg->internal too.

Oh, sorry! I forgot that!
 
> and nit, I don't understand what you intend by 'const unsigned int'. I
> think we can remove this const safely. it's more easy readable.

O.K. Will resend.

Apart from that, what didn't work as you expected?

Bruno

  reply	other threads:[~2010-10-22  0:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-20  8:23 [PATCH v3] Add generic exponentially weighted moving average (EWMA) function Bruno Randolf
2010-10-20 15:03 ` Peter Zijlstra
2010-10-21  5:40   ` Bruno Randolf
2010-10-21 10:04     ` Peter Zijlstra
2010-10-21 10:31 ` KOSAKI Motohiro
2010-10-22  0:53   ` Bruno Randolf [this message]
2010-10-22  1:11     ` KOSAKI Motohiro
2010-10-22  1:25       ` Bruno Randolf
2010-10-22  1:28         ` KOSAKI Motohiro

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=201010220953.30148.br1@einfach.org \
    --to=br1@einfach.org \
    --cc=Lars_Ericsson@telia.com \
    --cc=akpm@linux-foundation.org \
    --cc=blp@cs.stanford.edu \
    --cc=kevin.granade@gmail.com \
    --cc=kosaki.motohiro@jp.fujitsu.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=randy.dunlap@oracle.com \
    /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