Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1456107ybt; Thu, 25 Jun 2020 06:36:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwh96uGl8EgxnLJEzJm7euFeLshnni2NvR8Ok3mkZsMrCpAltDW1TVauKKMs0WtoZ4zKwpE X-Received: by 2002:a17:906:7c58:: with SMTP id g24mr31401030ejp.205.1593092171061; Thu, 25 Jun 2020 06:36:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593092171; cv=none; d=google.com; s=arc-20160816; b=qgzOlOXGkz9Eh179NkbKCuAaXAENJADVzBLaWkiM15J/SFfP9Bg2S2dme238BUiJM8 SHCjCEE8CVepxr3pfPFy+/nh8fo7d5jSqA9J6L1YczQgRe0axxURXm2z9p9HqGpeFs/v r993dE4F0rfuyr0Ffrz8pGpEFq7rUDsuNPSQ3a6T6MxNHsyFyHy59pVrXHEkWi5JIuZX c3FOM0hDPVC4TbFQ3x6BbmfZqPUKRc1dGhITHhVlyIOsJnH+Kouj4FVZ1Pg6AN1SdOSo SuxnHcCvxTo39R8iTbSaKVKByfb6pfHSGUSVqgJE1Vw5nYxkU3jno9z6kOsVBZWvrHy+ QwNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=09+fTYNd95SDGGKDwt8BrhJmqNTFAjuqhVxVc40SVsI=; b=vjsPEi1CHyNQhDMs82xkYxQA7vAaxjtTnIfYf8pHBBPCTU6Is5Ru3RXkW7QqWCmIEN 4e2BvekMNKsqmAwhEmkWRR8ERV0+OUgiqr5lNmpF/Z4DEXXKewgD/BLPWCTyKHgLyznL uOqVOgpffEDjLW6i75GnnBoxlWd0a2NobFXBZZoXQCFBBoPQNSZ8YlJn/u9Z9eR4lFpt HzqTrfV1CbpZN0CbcEPdC4QkUB8z8Wy5FheYvKST7KppP/13zaq1SuaGX/bc3oFftr1x svtDiJBOrwxlxCLfXVTPPR+UQBsleLzCsSQe1HUfxV4UhMxTQSTwDSjt6kSxLNLe8ErX ik5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V90esOam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id me25si6938745ejb.164.2020.06.25.06.35.47; Thu, 25 Jun 2020 06:36:11 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=V90esOam; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2405153AbgFYNew (ORCPT + 99 others); Thu, 25 Jun 2020 09:34:52 -0400 Received: from us-smtp-2.mimecast.com ([205.139.110.61]:46860 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404883AbgFYNeu (ORCPT ); Thu, 25 Jun 2020 09:34:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1593092089; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=09+fTYNd95SDGGKDwt8BrhJmqNTFAjuqhVxVc40SVsI=; b=V90esOam2b9nvpySBF/3qNLfisRtWbXS6bDW9x+yrwljorFyPenMX0hvrX7Lmss8ynAVO9 fhMI3XX3B+yoizCZ+GXTI/dWXjLHGie09DYgvok89hNxlBLH2n5s1RzSvI6n5BJM7QqOXb MMxDNTLfr5nxupKd4o9X+kcVuqAXe7U= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-2-EHCLg4BkNXypShWPKAECtw-1; Thu, 25 Jun 2020 09:34:47 -0400 X-MC-Unique: EHCLg4BkNXypShWPKAECtw-1 Received: by mail-wr1-f71.google.com with SMTP id e11so6873371wrs.2 for ; Thu, 25 Jun 2020 06:34:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=09+fTYNd95SDGGKDwt8BrhJmqNTFAjuqhVxVc40SVsI=; b=oWjpLZvSOAU7mwIA2GjeRqxGJ9w7T+TcK5OJhyYSzcdmR3Vd8MTpZX18eBZpGbhTUt 6mciSTYaH8ki2TNhv+JBgYJg1V2TyQkCknDUtyLvu/L6gwBFxJtPqXUSrPGZhVWvCmVn hgbEITPDN9WHicDuo7Jh+1rxkVu6PV9yXFGf2AQsUrUAL6lnFz/4tjQdi+fLJi+lu6Qa +EiSh0UIpMUYJo/gK+1X1nwmPJ74mmZx8oi0+LcP9OKR2LmcL5z5BU9fAkJZakARETqG Ud9e4/ucSxM3YRSK/FFk8/s/SpjKPlC6mURKcPPpSrudyNE7KHKEvgU3EHl/doYPW1e6 HCfg== X-Gm-Message-State: AOAM533b43rGYDA6lzw2EqNnezOg28eGCPZeD5keV0/NautKaYKVXmVu A4dFtGR5k/0AQQo0rwh51Bi+Dde4j01Hl9FRdXh8wNrwfD/U9Dzbrl9fmcXrqCVnQiPaQBCQixT 2QVmfHERmHRF8sRkPSw2OahoU X-Received: by 2002:a5d:4607:: with SMTP id t7mr29457164wrq.251.1593092086511; Thu, 25 Jun 2020 06:34:46 -0700 (PDT) X-Received: by 2002:a5d:4607:: with SMTP id t7mr29457132wrq.251.1593092086206; Thu, 25 Jun 2020 06:34:46 -0700 (PDT) Received: from localhost.localdomain ([151.29.187.107]) by smtp.gmail.com with ESMTPSA id d28sm34118699wrc.50.2020.06.25.06.34.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Jun 2020 06:34:45 -0700 (PDT) Date: Thu, 25 Jun 2020 15:34:43 +0200 From: Juri Lelli To: Sai Harshini Nimmala Cc: mingo@redhat.com, peterz@infradead.org, 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, adharmap@codeaurora.org, shalagra@codeaurora.org, dickey@codeaurora.org, satyap@codeaurora.org, pkondeti@codeaurora.org, clingutla@codeaurora.org, aiquny@codeaurora.org, rgottimu@codeaurora.org, Puja Gupta Subject: Re: [PATCH] Revert "sched/deadline: Remove cpu_active_mask from cpudl_find()" Message-ID: <20200625133443.GJ5763@localhost.localdomain> References: <1593065595-17794-1-git-send-email-snimmala@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1593065595-17794-1-git-send-email-snimmala@codeaurora.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 24/06/20 23:13, Sai Harshini Nimmala wrote: > 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 > Signed-off-by: Sai Harshini Nimmala > --- > 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); So, I believe the patch you want to revert only removed the condition above. > @@ -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); Did you actually experience issues with this second part as well? I'm thinking the WARN_ON should have fired in that case, no? Thanks, Juri