Received: by 2002:a25:1104:0:0:0:0:0 with SMTP id 4csp347340ybr; Fri, 22 May 2020 08:03:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwjUY4GSCJLfVv/sFSsb2/7oTXdPeNnMwANRzXvVseUcbBNhgTHNAzzdQ5ynYeph7Ju5OrP X-Received: by 2002:a05:6402:555:: with SMTP id i21mr3161598edx.119.1590159807260; Fri, 22 May 2020 08:03:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590159807; cv=none; d=google.com; s=arc-20160816; b=oiZPl1baIPlUWSHKDUKNaL/d4A47IVLZdlWNHl0yCrQbRnvGbEUStHZhQ4yZXLa64M PiYKkrLUZ0C8fnCG1N0Qnc7hT6bLZOi4WmWwjSuZWuud1yGDk5LYtTYN4OxI5dMrqajZ SgVlFl7lgmPZ8ksNh6tB0DClKJ8qS0rmUviqc/ESiiDCL4+C3TdBqkjE1Ban3v1hDjqr dg2drGknNOv5QPNzEVCXznGtSOD2aEqYe4A6uB1ENo5Gv2RFKeAjJRRsSWrFMw6HIWkn 7epe78H1KYYXZ8InQvygjXMoJN03HUbiKgyvwUyyUOLjAOlQcQxM448vfyQA/9iVUwC0 pi5Q== 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=9V1KMcVCYfmseNXs10csHjrAiE7ISkQIhvFETaCXQP4=; b=vISzL9RWgRkOBC+jxr64aE3AgUumD44NGlP5VNC7SBw3goM1TvmJp1t0ibLw8bnwi8 CD4U4tWjUGmiO7RZSi+ChNayGdMcIZATSyRHaFNP9kX4b44cOCVASxhB8mfY/d5xG9PL zSAOg2KTQO+muONwKRFkpemhhryvHVpJ2VpTXJ4jBsR4CySWGfdqVt7ShR0+U+NOtI+z pjT+lBPP4ogseyS+LMPR5bZZkiIWWC7ByttChwq3wonHzxO167j5LTdlM5C61wSFHIx5 +GeivwLLfiCw5bk92y0jilWTcmCXqDbiu/MCoLVw2tFJ8vp2jCsBq/W/jGVjN4f+9YoO tfNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=S4PISZ5Q; 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 w15si5171018ejq.27.2020.05.22.08.02.52; Fri, 22 May 2020 08:03:27 -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=S4PISZ5Q; 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 S1730960AbgEVO7L (ORCPT + 99 others); Fri, 22 May 2020 10:59:11 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:29489 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1730306AbgEVO7K (ORCPT ); Fri, 22 May 2020 10:59:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1590159548; 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=9V1KMcVCYfmseNXs10csHjrAiE7ISkQIhvFETaCXQP4=; b=S4PISZ5QTjDYKxVCkRBHJSL8KzmiSQZCBnjj+My6Xc6TZcQO6dEdlWLSFSGs5kLq7USRVL hVlkybR8GLSubMAsiFrBKpLDkZ3haawnWLT+/ZuPWUxw1ua6W8ZCgsJDfWAyDeh/qkZyrM uQxlBagSvMXsXua/TM3GHdUmhzY6zW8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-431-QzIjg918Mpat1EMVi8ib5w-1; Fri, 22 May 2020 10:59:06 -0400 X-MC-Unique: QzIjg918Mpat1EMVi8ib5w-1 Received: by mail-wm1-f72.google.com with SMTP id m11so2756197wml.5 for ; Fri, 22 May 2020 07:59:06 -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=9V1KMcVCYfmseNXs10csHjrAiE7ISkQIhvFETaCXQP4=; b=e+HGqm5yonCcHIWESO9XM/77a6YX7LqVjcYWtjZoVJoXfAQ8qpZ/hLXJGQ/oCDrPPC VVOZi2spws5BAeWKYrycNDHHYpY0W/zBH9lkJQwkyMg7oxGU7OROmoI9hHk1vu6rdBEN soko0kmF24dgdF4kA4gSoNJLcGsV4tmzb8kj+GX5XnlCZN6/1svd3CCeLJcYbKUyEha7 XtFWWi5AMo8nru1D8+0koprK+pb2GEAIXrJ2/G/I6ijHwmTZjwrOgbvJkyfcVMqT5bdm tt7fy8F6xhELfrhJLhidwd27l5FVbq5qNXR44YQ3dvlt9QEFO+yPBXX1WCrUirr3qdFV FqNA== X-Gm-Message-State: AOAM531kfAboOgQnX3P9X0rnEJqeTmj59QoWi/WELBJtwqbafL4IBKN7 hFh9nDAsZM2JLxVKV01G0a8Q3WheNLb2StviFU/oIfj3AyswsEQOy5qPUoxlC1PewEB/W60JRwM eLu0uIqw7bhvZ7zyRVMKRgjke X-Received: by 2002:a05:6000:1c5:: with SMTP id t5mr4066391wrx.229.1590159545170; Fri, 22 May 2020 07:59:05 -0700 (PDT) X-Received: by 2002:a05:6000:1c5:: with SMTP id t5mr4066372wrx.229.1590159544888; Fri, 22 May 2020 07:59:04 -0700 (PDT) Received: from localhost.localdomain ([151.29.176.125]) by smtp.gmail.com with ESMTPSA id h137sm16059488wme.0.2020.05.22.07.59.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 May 2020 07:59:04 -0700 (PDT) Date: Fri, 22 May 2020 16:59:02 +0200 From: Juri Lelli To: Dietmar Eggemann Cc: Ingo Molnar , Peter Zijlstra , Vincent Guittot , Steven Rostedt , Luca Abeni , Daniel Bristot de Oliveira , Wei Wang , Quentin Perret , Alessio Balsini , Pavan Kondeti , Patrick Bellasi , Morten Rasmussen , Valentin Schneider , Qais Yousef , linux-kernel@vger.kernel.org Subject: Re: [PATCH v3 5/5] sched/deadline: Implement fallback mechanism for !fit case Message-ID: <20200522145902.GF600689@localhost.localdomain> References: <20200520134243.19352-1-dietmar.eggemann@arm.com> <20200520134243.19352-6-dietmar.eggemann@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200520134243.19352-6-dietmar.eggemann@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/05/20 15:42, Dietmar Eggemann wrote: > From: Luca Abeni > > When a task has a runtime that cannot be served within the scheduling > deadline by any of the idle CPU (later_mask) the task is doomed to miss > its deadline. > > This can happen since the SCHED_DEADLINE admission control guarantees > only bounded tardiness and not the hard respect of all deadlines. > In this case try to select the idle CPU with the largest CPU capacity > to minimize tardiness. > > Favor task_cpu(p) if it has max capacity of !fitting CPUs so that > find_later_rq() can potentially still return it (most likely cache-hot) > early. > > Signed-off-by: Luca Abeni > Signed-off-by: Dietmar Eggemann > --- > kernel/sched/cpudeadline.c | 20 ++++++++++++++++---- > 1 file changed, 16 insertions(+), 4 deletions(-) > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c > index 8630f2a40a3f..8cb06c8c7eb1 100644 > --- a/kernel/sched/cpudeadline.c > +++ b/kernel/sched/cpudeadline.c > @@ -121,19 +121,31 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, > > if (later_mask && > cpumask_and(later_mask, cp->free_cpus, p->cpus_ptr)) { > - int cpu; > + unsigned long cap, max_cap = 0; > + int cpu, max_cpu = -1; > > if (!static_branch_unlikely(&sched_asym_cpucapacity)) > return 1; > > /* Ensure the capacity of the CPUs fits the task. */ > for_each_cpu(cpu, later_mask) { > - if (!dl_task_fits_capacity(p, cpu)) > + if (!dl_task_fits_capacity(p, cpu)) { > cpumask_clear_cpu(cpu, later_mask); > + > + cap = capacity_orig_of(cpu); > + > + if (cap > max_cap || > + (cpu == task_cpu(p) && cap == max_cap)) { > + max_cap = cap; > + max_cpu = cpu; > + } > + } > } > > - if (!cpumask_empty(later_mask)) > - return 1; > + if (cpumask_empty(later_mask)) > + cpumask_set_cpu(max_cpu, later_mask); > + > + return 1; > } else { > int best_cpu = cpudl_maximum(cp); > > -- Acked-by: Juri Lelli