[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20101021192658.C8EE.A69D9226@jp.fujitsu.com>
Date: Thu, 21 Oct 2010 19:31:47 +0900 (JST)
From: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
To: Bruno Randolf <br1@...fach.org>
Cc: kosaki.motohiro@...fujitsu.com, randy.dunlap@...cle.com,
akpm@...ux-foundation.org, kevin.granade@...il.com,
Lars_Ericsson@...ia.com, blp@...stanford.edu,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] Add generic exponentially weighted moving average (EWMA) function
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.
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists