Received: by 2002:a25:1985:0:0:0:0:0 with SMTP id 127csp827145ybz; Fri, 1 May 2020 09:14:03 -0700 (PDT) X-Google-Smtp-Source: APiQypJzy3fo3uqelShubukSTyfGZovB9h6BS4uTy7EEEgwSa8uctXCfsdsnQsXZsBCWjqwb8QHf X-Received: by 2002:a17:906:7f13:: with SMTP id d19mr3924606ejr.57.1588349643409; Fri, 01 May 2020 09:14:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588349643; cv=none; d=google.com; s=arc-20160816; b=rMpr3ntNVF8M2tlt/ihSATaQNasMZT1pcSdG2mMfUJRXYMIpVmEqeVDi5fQL37rXLl uOkv29hyR1cyVPAjQd4ZmZwXTGU7q+y8GR7UKe7423MzQOh9Ek3AUJhE1XExGotkIfmj 391dsPFUqleqZ+pJ6l3e+7UXD+SEpw2dmDot78cQFJzfMJHZoaPjhLFBBVJy0p5rNO/p 8X4MiIw10mAIt7a7Gey27YNg9VlbA+cRx5MI8Ewf2epJPEb4g/+XHeWf09yo/nblENyK dk8kUU1LGLfTp11R6RMX3AkoJ4uwaF2g/VtfWY35RxSfuGdSlN/RGtpSokzCOefVUtAr fjeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=8u+JCkix4Ln69juiUIgAnkwrzBdh7vJAsxh7buSX0sA=; b=Kl8nw4DFPo8jLp5CJtgW0r8kIp6o2ZLfjOPreTIO5Z1KY1t70wiCS7j5FnU570Nbo1 8Ln8X1UrNHw1TjGJr6nT/tCPF/3Uy7fkpyVelt0AEkIQyrPKlznBEUZKe76cunAckkwi 659neEjnA6+2tWcVjIdt6w/COccZzqtVjP9Y24ydI1x11S+CIi6CdsAKoeyDgf75A925 zuEJjAVIDEy2ZDp3O++lVYB3E1+uLoZLsbUwA8BN3oIL0bDk+Tau1e/RzTP2mn0Ums4W IWscSWAqrGm7kxJ0fcnKp/pIm23eIs5Z05y+mShAcs8VLaNdM6qKuev9aODEa3bRjeGY NMaA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id n16si2027010edy.219.2020.05.01.09.13.39; Fri, 01 May 2020 09:14:03 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730133AbgEAQMN (ORCPT + 99 others); Fri, 1 May 2020 12:12:13 -0400 Received: from foss.arm.com ([217.140.110.172]:43348 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730082AbgEAQMM (ORCPT ); Fri, 1 May 2020 12:12:12 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id A474C31B; Fri, 1 May 2020 09:12:11 -0700 (PDT) Received: from [192.168.0.7] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 362503F85E; Fri, 1 May 2020 09:12:09 -0700 (PDT) Subject: Re: [PATCH v2 5/6] sched/deadline: Make DL capacity-aware To: Pavan Kondeti Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org References: <20200427083709.30262-1-dietmar.eggemann@arm.com> <20200427083709.30262-6-dietmar.eggemann@arm.com> <20200430131036.GE19464@codeaurora.org> From: Dietmar Eggemann Message-ID: Date: Fri, 1 May 2020 18:12:07 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 MIME-Version: 1.0 In-Reply-To: <20200430131036.GE19464@codeaurora.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 30/04/2020 15:10, Pavan Kondeti wrote: > On Mon, Apr 27, 2020 at 10:37:08AM +0200, Dietmar Eggemann wrote: >> From: Luca Abeni [...] >> @@ -1653,10 +1654,19 @@ select_task_rq_dl(struct task_struct *p, int cpu, int sd_flag, int flags) >> * other hand, if it has a shorter deadline, we >> * try to make it stay here, it might be important. >> */ >> - if (unlikely(dl_task(curr)) && >> - (curr->nr_cpus_allowed < 2 || >> - !dl_entity_preempt(&p->dl, &curr->dl)) && >> - (p->nr_cpus_allowed > 1)) { >> + select_rq = unlikely(dl_task(curr)) && >> + (curr->nr_cpus_allowed < 2 || >> + !dl_entity_preempt(&p->dl, &curr->dl)) && >> + p->nr_cpus_allowed > 1; >> + >> + /* >> + * Take the capacity of the CPU into account to >> + * ensure it fits the requirement of the task. >> + */ >> + if (static_branch_unlikely(&sched_asym_cpucapacity)) >> + select_rq |= !dl_task_fits_capacity(p, cpu); >> + >> + if (select_rq) { >> int target = find_later_rq(p); > > I see that find_later_rq() checks if the previous CPU is part of > later_mask and returns it immediately. So we don't migrate the > task in the case where there previous CPU can't fit the task and > there are no idle CPUs on which the task can fit. LGTM. Hope I understand you here. I don't think that [patch 6/6] provides this already. In case 'later_mask' has no fitting CPUs, 'max_cpu' is set in the otherwise empty 'later_mask'. But 'max_cpu' is not necessary task_cpu(p). Example on Juno [L b b L L L] with thread0-0 (big task) cpudl_find [thread0-0 2117] orig later_mask=0,3-4 later_mask=0 find_later_rq [thread0-0 2117] task_cpu=2 later_mask=0 A tweak could be added favor task_cpu(p) in case it is amongst the CPUs with the maximum capacity in cpudl_find() for the !fit case. [...] >> +/* >> + * Verify the fitness of task @p to run on @cpu taking into account the >> + * CPU original capacity and the runtime/deadline ratio of the task. >> + * >> + * The function will return true if the CPU original capacity of the >> + * @cpu scaled by SCHED_CAPACITY_SCALE >= runtime/deadline ratio of the >> + * task and false otherwise. >> + */ >> +static inline bool dl_task_fits_capacity(struct task_struct *p, int cpu) >> +{ >> + unsigned long cap = arch_scale_cpu_capacity(cpu); >> + >> + return cap_scale(p->dl.dl_deadline, cap) >= p->dl.dl_runtime; >> +} >> + > > This is same as > > return p->dl.dl_bw >> (BW_SHIFT - SCHED_CAPACITY_SHIFT) <= cap > > Correct? If yes, would it be better to use this? We could use sched_dl_entity::dl_density (dl_runtime / dl_deadline) but then I would have to export BW_SHIFT.