linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Jacob Pan <jacob.jun.pan@linux.intel.com>
Cc: Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@redhat.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	LKML <linux-kernel@vger.kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Rafael Wysocki <rafael.j.wysocki@intel.com>,
	Arjan van de Ven <arjan@linux.intel.com>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Len Brown <lenb@kernel.org>,
	Eduardo Valentin <edubezval@gmail.com>,
	Zhang Rui <rui.zhang@intel.com>, Petr Mladek <pmladek@suse.com>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: Re: [PATCH v3 1/3] idle: add support for tasks that inject idle
Date: Thu, 24 Nov 2016 05:18:48 +0100	[thread overview]
Message-ID: <20161124041848.GB29338@gmail.com> (raw)
In-Reply-To: <1479931990-11732-2-git-send-email-jacob.jun.pan@linux.intel.com>


* Jacob Pan <jacob.jun.pan@linux.intel.com> wrote:

> From: Peter Zijlstra <peterz@infradead.org>
> 
> Idle injection drivers such as Intel powerclamp and ACPI PAD drivers use
> realtime tasks to take control of CPU then inject idle. There are two issues
> with this approach:

'CPU' is capitalized properly here.

And here:

>  #define PF_VCPU		0x00000010	/* I'm a virtual CPU */

But not later in the patch.

> +++ b/kernel/fork.c
> @@ -1819,6 +1819,9 @@ static __latent_entropy struct task_struct *copy_process(
>  	threadgroup_change_end(current);
>  	perf_event_fork(p);
>  
> +	/* do not inherit idle task */
> +	p->flags &= ~PF_IDLE;

Sloppy formulation: how can the idle task be inherited? Also, capitalize comments 
please.

> +	/*
> +	 * If the arch has a polling bit, we maintain an invariant:
> +	 *
> +	 * Our polling bit is clear if we're not scheduled (i.e. if
> +	 * rq->curr != rq->idle).  This means that, if rq->idle has
> +	 * the polling bit set, then setting need_resched is
> +	 * guaranteed to cause the cpu to reschedule.
> +	 */

'CPU' is not properly capitalized here.

> +	/* In poll mode we reenable interrupts and spin.
> +	 * Also if we detected in the wakeup from idle
> +	 * path that the tick broadcast device expired
> +	 * for us, we don't want to go deep idle as we
> +	 * know that the IPI is going to arrive right
> +	 * away
> +	 */
> +		if (cpu_idle_force_poll || tick_check_broadcast_expired())
> +			cpu_idle_poll();
> +		else
> +			cpuidle_idle_call();
> +		arch_cpu_idle_exit();

Sigh: that's not standard comment style, nor is it standard coding style.

Also, multi-sentence comments should end with a full stop.

> +	/*
> +	 * We promise to call sched_ttwu_pending and reschedule
> +	 * if need_resched is set while polling is set.  That
> +	 * means that clearing polling needs to be visible
> +	 * before doing these things.
> +	 */

When referring to functions in comments please spell them as "fn()", i.e. with 
parentheses.

> +	/*
> +	 * If duration is 0, we will return after a natural wake event occurs. If
> +	 * duration is none zero, we will go back to sleep if we were woken up earlier.
> +	 * We also set up a timer to make sure we don't oversleep in deep idle.
> +	 */
> +	if (!duration_ms)
> +		do_idle();
> +	else {
> +		hrtimer_init_on_stack(&timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
> +		timer.function = idle_inject_timer_fn;
> +		hrtimer_start(&timer, ms_to_ktime(duration_ms),
> +			HRTIMER_MODE_REL_PINNED);
> +		end_time = jiffies + msecs_to_jiffies(duration_ms);
> +
> +		while (time_after(end_time, jiffies))
> +			do_idle();
> +	}

Curly braces should be balanced and nonsensical line breaks should be omitted.

Also, comments should be read and grammar should be fixed.

Thanks,

	Ingo

  reply	other threads:[~2016-11-24  4:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-23 20:13 [PATCH v3 0/3] Stop sched tick in idle injection task Jacob Pan
2016-11-23 20:13 ` [PATCH v3 1/3] idle: add support for tasks that inject idle Jacob Pan
2016-11-24  4:18   ` Ingo Molnar [this message]
2016-11-24  9:50   ` Peter Zijlstra
2016-11-24 11:04     ` Ingo Molnar
2016-11-24 13:44       ` Rafael J. Wysocki
2016-11-23 20:13 ` [PATCH v3 2/3] cpuidle: allow setting deepest idle Jacob Pan
2016-11-23 20:13 ` [PATCH v3 3/3] thermal/powerclamp: stop sched tick in forced idle Jacob Pan
2016-11-23 21:12 ` [PATCH v3 0/3] Stop sched tick in idle injection task Rafael J. Wysocki
2016-11-23 21:45   ` Peter Zijlstra
2016-11-23 22:38     ` Rafael J. Wysocki
2016-11-24  0:25       ` Jacob Pan
2016-11-24  0:24         ` Rafael J. Wysocki
2016-11-24  4:21   ` Ingo Molnar

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=20161124041848.GB29338@gmail.com \
    --to=mingo@kernel.org \
    --cc=arjan@linux.intel.com \
    --cc=bigeasy@linutronix.de \
    --cc=edubezval@gmail.com \
    --cc=jacob.jun.pan@linux.intel.com \
    --cc=lenb@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pmladek@suse.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=rui.zhang@intel.com \
    --cc=srinivas.pandruvada@linux.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).