From: Juri Lelli <juri.lelli@arm.com>
To: peterz@infradead.org
Cc: juri.lelli@gmail.com, linux-kernel@vger.kernel.org,
Juri Lelli <juri.lelli@arm.com>, Ingo Molnar <mingo@redhat.com>
Subject: [PATCH] sched/core: dl_bw_of() has to be used under rcu_read_lock_sched()
Date: Tue, 28 Oct 2014 11:54:46 +0000 [thread overview]
Message-ID: <1414497286-28824-1-git-send-email-juri.lelli@arm.com> (raw)
As per commit f10e00f4bf36 ("sched/dl: Use dl_bw_of() under
rcu_read_lock_sched()"), dl_bw_of() has to be protected by
rcu_read_lock_sched().
Signed-off-by: Juri Lelli <juri.lelli@arm.com>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: linux-kernel@vger.kernel.org
---
kernel/sched/core.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index b9f78f1..b9fb426 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4657,6 +4657,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur,
struct dl_bw *cur_dl_b;
unsigned long flags;
+ rcu_read_lock_sched();
cur_dl_b = dl_bw_of(cpumask_any(cur));
trial_cpus = cpumask_weight(trial);
@@ -4665,6 +4666,7 @@ int cpuset_cpumask_can_shrink(const struct cpumask *cur,
cur_dl_b->bw * trial_cpus < cur_dl_b->total_bw)
ret = 0;
raw_spin_unlock_irqrestore(&cur_dl_b->lock, flags);
+ rcu_read_unlock_sched();
return ret;
}
@@ -4693,11 +4695,13 @@ int task_can_attach(struct task_struct *p,
cs_cpus_allowed)) {
unsigned int dest_cpu = cpumask_any_and(cpu_active_mask,
cs_cpus_allowed);
- struct dl_bw *dl_b = dl_bw_of(dest_cpu);
+ struct dl_bw *dl_b;
bool overflow;
int cpus;
unsigned long flags;
+ rcu_read_lock_sched();
+ dl_b = dl_bw_of(dest_cpu);
raw_spin_lock_irqsave(&dl_b->lock, flags);
cpus = dl_bw_cpus(dest_cpu);
overflow = __dl_overflow(dl_b, cpus, 0, p->dl.dl_bw);
@@ -4713,6 +4717,7 @@ int task_can_attach(struct task_struct *p,
__dl_add(dl_b, p->dl.dl_bw);
}
raw_spin_unlock_irqrestore(&dl_b->lock, flags);
+ rcu_read_unlock_sched();
}
#endif
--
2.1.2
next reply other threads:[~2014-10-28 11:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-28 11:54 Juri Lelli [this message]
2014-11-04 16:10 ` [tip:sched/core] sched/core: Use dl_bw_of() " 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=1414497286-28824-1-git-send-email-juri.lelli@arm.com \
--to=juri.lelli@arm.com \
--cc=juri.lelli@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
/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
all inboxes | Powered by JetHome®