linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Joe Perches <joe@perches.com>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Linux PM <linux-pm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Len Brown <len.brown@intel.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	"H. Peter Anvin" <hpa@zytor.com>, Ingo Molnar <mingo@elte.hu>,
	Zhang Rui <rui.zhang@intel.com>, Rob Landley <rob@landley.net>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Paul McKenney <paulmck@linux.vnet.ibm.com>
Subject: Re: [PATCH v2 3/3] PM: Introduce Intel PowerClamp Driver
Date: Mon, 26 Nov 2012 15:27:25 -0800	[thread overview]
Message-ID: <1353972445.2493.19.camel@joe-AO722> (raw)
In-Reply-To: <1353940633-20084-4-git-send-email-jacob.jun.pan@linux.intel.com>

On Mon, 2012-11-26 at 06:37 -0800, Jacob Pan wrote:
> Intel PowerClamp driver performs synchronized idle injection across
> all online CPUs. The goal is to maintain a given package level C-state
> ratio.

trivial notes:

> diff --git a/drivers/thermal/intel_powerclamp.c b/drivers/thermal/intel_powerclamp.c

You should still add #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
before any include so that all messages are prefixed with powerclamp:

> +
> +/* #define DEBUG */
> +
> +#include <linux/module.h>
> +#include <linux/kernel.h>
[]
> +static void adjust_compensation(int target_ratio, unsigned int win)
> +{
> +	int delta;

It'd be shorter code to use a temporary like

	struct powerclamp_calibration_data *d = &cal_data[target_ratio];

> +
> +	/*
> +	 * adjust compensations if confidence level has not been reached or
> +	 * there are too many wakeups during the last idle injection period, we
> +	 * cannot trust the data for compensation.
> +	 */
> +	if (cal_data[target_ratio].confidence >= CONFIDENCE_OK ||
> +		atomic_read(&idle_wakeup_counter) >
> +		win * num_online_cpus())
> +		return;
> +
> +	delta = set_target_ratio - current_ratio;
> +	/* filter out bad data */
> +	if (delta >= 0 && delta <= (1+target_ratio/10)) {
> +		if (cal_data[target_ratio].steady_comp)
> +			cal_data[target_ratio].steady_comp =
> +				roundup(delta+
> +					cal_data[target_ratio].steady_comp,
> +					2)/2;

so that this fits on a single line and becomes:

		if (d->steady_comp)
			d->steady_comp = roundup(delta + d->steady_comp, 2) / 2;
 
	etc.

What clamps target_ratio to the correct range?
I briefly scanned the code but didn't spot it.


  reply	other threads:[~2012-11-26 23:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-26 14:37 [PATCH v2 0/3] pm: Intel powerclamp driver Jacob Pan
2012-11-26 14:37 ` [PATCH v2 1/3] tick: export nohz tick idle symbols for module use Jacob Pan
2012-11-26 14:37 ` [PATCH v2 2/3] x86/nmi: export local_touch_nmi() symbol for modules Jacob Pan
2012-11-26 14:37 ` [PATCH v2 3/3] PM: Introduce Intel PowerClamp Driver Jacob Pan
2012-11-26 23:27   ` Joe Perches [this message]
2012-11-27 19:01     ` Jacob Pan

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=1353972445.2493.19.camel@joe-AO722 \
    --to=joe@perches.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=arjan@linux.intel.com \
    --cc=hpa@zytor.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rob@landley.net \
    --cc=rui.zhang@intel.com \
    --cc=tglx@linutronix.de \
    /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).