public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Borislav Petkov <bp@alien8.de>
To: peterz@infradead.org, tglx@linutronix.de, juri.lelli@gmail.com,
	linux-kernel@vger.kernel.org, mingo@kernel.org, hpa@zytor.com,
	juri.lelli@arm.com
Cc: linux-tip-commits@vger.kernel.org
Subject: Re: [tip:sched/core] sched/core: Check for available DL bandwidth in cpuset_cpu_inactive()
Date: Fri, 3 Apr 2015 10:42:17 +0200	[thread overview]
Message-ID: <20150403084217.GA27111@pd.tnic> (raw)
In-Reply-To: <tip-3c18d447b3b36a8d3c90dc37dfbd363cdb685d0a@git.kernel.org>

On Thu, Apr 02, 2015 at 11:47:04AM -0700, tip-bot for Juri Lelli wrote:
> Commit-ID:  3c18d447b3b36a8d3c90dc37dfbd363cdb685d0a
> Gitweb:     http://git.kernel.org/tip/3c18d447b3b36a8d3c90dc37dfbd363cdb685d0a
> Author:     Juri Lelli <juri.lelli@arm.com>
> AuthorDate: Tue, 31 Mar 2015 09:53:37 +0100
> Committer:  Ingo Molnar <mingo@kernel.org>
> CommitDate: Thu, 2 Apr 2015 17:42:56 +0200
> 
> sched/core: Check for available DL bandwidth in cpuset_cpu_inactive()
> 
> Hotplug operations are destructive w.r.t. cpusets. In case such an
> operation is performed on a CPU belonging to an exlusive cpuset, the
> DL bandwidth information associated with the corresponding root
> domain is gone even if the operation fails (in sched_cpu_inactive()).
> 
> For this reason we need to move the check we currently have in
> sched_cpu_inactive() to cpuset_cpu_inactive() to prevent useless
> cpusets reconfiguration in the CPU_DOWN_FAILED path.
> 
> Signed-off-by: Juri Lelli <juri.lelli@arm.com>
> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> Cc: Juri Lelli <juri.lelli@gmail.com>
> Link: http://lkml.kernel.org/r/1427792017-7356-2-git-send-email-juri.lelli@arm.com
> Signed-off-by: Ingo Molnar <mingo@kernel.org>
> ---
>  kernel/sched/core.c | 56 ++++++++++++++++++++++++++---------------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
> 
> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
> index 4c49e75..28b0d75 100644
> --- a/kernel/sched/core.c
> +++ b/kernel/sched/core.c
> @@ -5337,36 +5337,13 @@ static int sched_cpu_active(struct notifier_block *nfb,
>  static int sched_cpu_inactive(struct notifier_block *nfb,
>  					unsigned long action, void *hcpu)
>  {
> -	unsigned long flags;
> -	long cpu = (long)hcpu;
> -	struct dl_bw *dl_b;
> -
>  	switch (action & ~CPU_TASKS_FROZEN) {
>  	case CPU_DOWN_PREPARE:
> -		set_cpu_active(cpu, false);
> -
> -		/* explicitly allow suspend */
> -		if (!(action & CPU_TASKS_FROZEN)) {
> -			bool overflow;
> -			int cpus;
> -
> -			rcu_read_lock_sched();
> -			dl_b = dl_bw_of(cpu);
> -
> -			raw_spin_lock_irqsave(&dl_b->lock, flags);
> -			cpus = dl_bw_cpus(cpu);
> -			overflow = __dl_overflow(dl_b, cpus, 0, 0);
> -			raw_spin_unlock_irqrestore(&dl_b->lock, flags);
> -
> -			rcu_read_unlock_sched();
> -
> -			if (overflow)
> -				return notifier_from_errno(-EBUSY);
> -		}
> +		set_cpu_active((long)hcpu, false);
>  		return NOTIFY_OK;
> +	default:
> +		return NOTIFY_DONE;
>  	}
> -
> -	return NOTIFY_DONE;
>  }
>  
>  static int __init migration_init(void)
> @@ -7006,7 +6983,6 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
>  		 */
>  
>  	case CPU_ONLINE:
> -	case CPU_DOWN_FAILED:
>  		cpuset_update_active_cpus(true);
>  		break;
>  	default:
> @@ -7018,8 +6994,32 @@ static int cpuset_cpu_active(struct notifier_block *nfb, unsigned long action,
>  static int cpuset_cpu_inactive(struct notifier_block *nfb, unsigned long action,
>  			       void *hcpu)
>  {
> -	switch (action) {
> +	unsigned long flags;
> +	long cpu = (long)hcpu;
> +	struct dl_bw *dl_b;
> +
> +	switch (action & ~CPU_TASKS_FROZEN) {
>  	case CPU_DOWN_PREPARE:
> +		/* explicitly allow suspend */
> +		if (!(action & CPU_TASKS_FROZEN)) {
> +			bool overflow;
> +			int cpus;
> +
> +			rcu_read_lock_sched();
> +			dl_b = dl_bw_of(cpu);
> +
> +			raw_spin_lock_irqsave(&dl_b->lock, flags);
> +			cpus = dl_bw_cpus(cpu);
> +			overflow = __dl_overflow(dl_b, cpus, 0, 0);
> +			raw_spin_unlock_irqrestore(&dl_b->lock, flags);
> +
> +			rcu_read_unlock_sched();
> +
> +			if (overflow) {
> +				trace_printk("hotplug failed for cpu %lu", cpu);

Look ma,

someone forgot debugging code:

...
[    0.000000] 	RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=2.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=2
[    0.000000] 
[    0.000000] **********************************************************
[    0.000000] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    0.000000] **                                                      **
[    0.000000] ** trace_printk() being used. Allocating extra memory.  **
[    0.000000] **                                                      **
[    0.000000] ** This means that this is a DEBUG kernel and it is     **
[    0.000000] ** unsafe for production use.                           **
[    0.000000] **                                                      **
[    0.000000] ** If you see this message and you are not debugging    **
[    0.000000] ** the kernel, report this immediately to your vendor!  **
[    0.000000] **                                                      **
[    0.000000] **   NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE NOTICE   **
[    0.000000] **********************************************************

Fix coming up.

-- 
Regards/Gruss,
    Boris.

ECO tip #101: Trim your mails when you reply.
--

  reply	other threads:[~2015-04-03  8:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-31  8:53 [PATCH] sched/deadline: always enqueue on previous rq when dl_task_timer fires Juri Lelli
2015-03-31  8:53 ` [PATCH] sched/core: check for available -dl bandwidth in cpuset_cpu_inactive Juri Lelli
2015-04-02 18:47   ` [tip:sched/core] sched/core: Check for available DL bandwidth in cpuset_cpu_inactive() tip-bot for Juri Lelli
2015-04-03  8:42     ` Borislav Petkov [this message]
2015-04-03 14:21       ` Peter Zijlstra
2015-04-03 15:26         ` Borislav Petkov
2015-04-02 18:46 ` [tip:sched/core] sched/deadline: Always enqueue on previous rq when dl_task_timer() fires tip-bot for Juri Lelli

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=20150403084217.GA27111@pd.tnic \
    --to=bp@alien8.de \
    --cc=hpa@zytor.com \
    --cc=juri.lelli@arm.com \
    --cc=juri.lelli@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    --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