linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: Sai Harshini Nimmala <snimmala@codeaurora.org>
To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
	vincent.guittot@linaro.org, dietmar.eggemann@arm.com,
	rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de,
	linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org,
	linux-arm-msm-owner@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org
Cc: rgottimu@codeaurora.org, clingutla@codeaurora.org,
	adharmap@codeaurora.org, Puja Gupta <pujag@codeaurora.org>,
	dickey@codeaurora.org,
	Sai Harshini Nimmala <snimmala@codeaurora.org>,
	shalagra@codeaurora.org, satyap@codeaurora.org,
	aiquny@codeaurora.org, pkondeti@codeaurora.org
Subject: [PATCH] Revert "sched/deadline: Remove cpu_active_mask from cpudl_find()"
Date: Wed, 24 Jun 2020 23:13:15 -0700	[thread overview]
Message-ID: <1593065595-17794-1-git-send-email-snimmala@codeaurora.org> (raw)

The original commit 9659e1ee removes checking the cpu_active_mask
while finding the best cpu to place a deadline task, citing the reason that
this mask rarely changes and removing the check will give performance
gains.
However, on hotplugging, the cpu dying path has a brief duration between
the CPUHP_TEARDOWN_CPU and CPUHP_AP_SCHED_STARTING hotplug states where
the DL task can be scheduled on this cpu because the corresponding cpu
bit in cpu->free_cpus has not been cleared yet. Without the
cpu_active_mask check we could end up putting a DL task on such cpus
leading to a BUG.
The cpu_active_mask will be updated promptly before either of these
states and will provide a more accurate check for the use case above.

Signed-off-by: Puja Gupta <pujag@codeaurora.org>
Signed-off-by: Sai Harshini Nimmala <snimmala@codeaurora.org>
---
 kernel/sched/cpudeadline.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c
index 5cc4012..0346837 100644
--- a/kernel/sched/cpudeadline.c
+++ b/kernel/sched/cpudeadline.c
@@ -120,7 +120,8 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
 	const struct sched_dl_entity *dl_se = &p->dl;
 
 	if (later_mask &&
-	    cpumask_and(later_mask, cp->free_cpus, p->cpus_ptr)) {
+	    cpumask_and(later_mask, cp->free_cpus, p->cpus_ptr) &&
+	    cpumask_and(later_mask, later_mask, cpu_active_mask)) {
 		return 1;
 	} else {
 		int best_cpu = cpudl_maximum(cp);
@@ -128,6 +129,7 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p,
 		WARN_ON(best_cpu != -1 && !cpu_present(best_cpu));
 
 		if (cpumask_test_cpu(best_cpu, p->cpus_ptr) &&
+		    cpumask_test_cpu(best_cpu, cpu_active_mask) &&
 		    dl_time_before(dl_se->deadline, cp->elements[0].dl)) {
 			if (later_mask)
 				cpumask_set_cpu(best_cpu, later_mask);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

             reply	other threads:[~2020-06-25  6:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-25  6:13 Sai Harshini Nimmala [this message]
2020-06-25 13:34 ` [PATCH] Revert "sched/deadline: Remove cpu_active_mask from cpudl_find()" 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=1593065595-17794-1-git-send-email-snimmala@codeaurora.org \
    --to=snimmala@codeaurora.org \
    --cc=adharmap@codeaurora.org \
    --cc=aiquny@codeaurora.org \
    --cc=bsegall@google.com \
    --cc=clingutla@codeaurora.org \
    --cc=dickey@codeaurora.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=juri.lelli@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm-owner@vger.kernel.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=pkondeti@codeaurora.org \
    --cc=pujag@codeaurora.org \
    --cc=rgottimu@codeaurora.org \
    --cc=rostedt@goodmis.org \
    --cc=satyap@codeaurora.org \
    --cc=shalagra@codeaurora.org \
    --cc=vincent.guittot@linaro.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;
as well as URLs for NNTP newsgroup(s).