Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp3910927yba; Tue, 7 May 2019 08:59:05 -0700 (PDT) X-Google-Smtp-Source: APXvYqzpI9wRMESHaJK/KHuQDU9JaL+JLFWl8AmlyJT9YseB7b5bDZ4pPforPDY9utOv9vCrtAvY X-Received: by 2002:a63:fb4d:: with SMTP id w13mr40764494pgj.397.1557244745103; Tue, 07 May 2019 08:59:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1557244745; cv=none; d=google.com; s=arc-20160816; b=cl/+w0ucOnil8Ozp0hQWdH/DkcyTz2+vpTVQZ6lGq4p7Ex8kOQMplTFCB9lor0UUbe a1DH8I+4FHjb4nBjxyootWmgIwdRZKuLncc8NZT5jubY/he4KzQ5CcyMezcth+0VEU56 jMhAIt6hlNhH8INt9poIXeVy6juLZs5bA6qL17GX0J4fZ3wSyB3lx+iWGxssYBq+oGmf 6nZR20Ej5lZcJGesJa+Jdqpd9s043wgKxjR5F7y7q28L31Ez9dZdm+BnuHL0W2G/aei3 MF46cpFi9yeXOs1t2+eKfEGCkxivK+IFVeUbVxTQNkScPOZSxhN9q+kRiXyuPkvP7Rkl beGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=eRGmoIeqRpvsY4a79QP/o1lSbWkeyrzUgGVs/F0aZcU=; b=jLVRtL6e5vpDUb6DVBW0+Xx4b0ja2o/xIoyEyYpB8Rr9lwjn0Xqrp07hKqsNDC0ZL0 RKHCQ+KujslqDbyJS3VisT9Z4zA9OD3ek3TJxZ/gPP+Xx0J8KQDTjkCzdLzdpxkrdyvs ZtFOD5e0O2iO7AQv5OGrxsuQg5/TvnrKBZarbPibRTUUBKZI94hDUPyAapUUEfBzT3Mg /PeIywmSACmnLRhH58kKf46PjGtku0S1vosPcXJCpBddcMIbSquEFUCcw0jbwNwEx4RW T/eQownrisAyq68rJRp+80FR0IN+1Zn6uSpZvz9NhmPbuQJazgbXdI+rNk1SdY7iV+Ck wWJw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si312370pgq.246.2019.05.07.08.58.46; Tue, 07 May 2019 08:59:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726557AbfEGP5j (ORCPT + 99 others); Tue, 7 May 2019 11:57:39 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:58270 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726438AbfEGP5j (ORCPT ); Tue, 7 May 2019 11:57:39 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 8898A374; Tue, 7 May 2019 08:57:38 -0700 (PDT) Received: from queper01-lin (queper01-lin.cambridge.arm.com [10.1.195.48]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 08F583F5AF; Tue, 7 May 2019 08:57:35 -0700 (PDT) Date: Tue, 7 May 2019 16:57:34 +0100 From: Quentin Perret To: Luca Abeni Cc: linux-kernel@vger.kernel.org, Greg Kroah-Hartman , "Rafael J . Wysocki" , Ingo Molnar , Peter Zijlstra , Vincent Guittot , "Paul E . McKenney" , Joel Fernandes , Luc Van Oostenryck , Morten Rasmussen , Juri Lelli , Daniel Bristot de Oliveira , Patrick Bellasi , Tommaso Cucinotta Subject: Re: [RFC PATCH 6/6] sched/dl: Try not to select a too fast core Message-ID: <20190507155732.7ravrnld54rb6k5a@queper01-lin> References: <20190506044836.2914-1-luca.abeni@santannapisa.it> <20190506044836.2914-7-luca.abeni@santannapisa.it> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190506044836.2914-7-luca.abeni@santannapisa.it> User-Agent: NeoMutt/20171215 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Monday 06 May 2019 at 06:48:36 (+0200), Luca Abeni wrote: > From: luca abeni > > When a task can fit on multiple CPU cores, try to select the slowest > core that is able to properly serve the task. This avoids useless > future migrations, leaving the "fast cores" idle for more heavyweight > tasks. But only if the _current_ capacity of big CPUs (at the current freq) is higher than the current capacity of the littles, is that right ? So we don't really have a guarantee to pack small tasks on little cores ... What is the rationale for looking at the current freq in dl_task_fit() ? Energy reasons ? If so, I'd argue you should look at the energy model to break the tie between CPU candidates ... ;) And in the mean time, you could just look at arch_scale_cpu_capacity() to check if a task fits ? > Signed-off-by: luca abeni > --- > kernel/sched/cpudeadline.c | 17 ++++++++++++----- > 1 file changed, 12 insertions(+), 5 deletions(-) > > diff --git a/kernel/sched/cpudeadline.c b/kernel/sched/cpudeadline.c > index 2a4ac7b529b7..897ed71af515 100644 > --- a/kernel/sched/cpudeadline.c > +++ b/kernel/sched/cpudeadline.c > @@ -143,17 +143,24 @@ int cpudl_find(struct cpudl *cp, struct task_struct *p, > struct cpumask *later_mask) > { > const struct sched_dl_entity *dl_se = &p->dl; > + struct cpumask tmp_mask; Hmm, these can get pretty big, so not sure about having one on the stack ... > > if (later_mask && > - cpumask_and(later_mask, cp->free_cpus, &p->cpus_allowed)) { > + cpumask_and(&tmp_mask, cp->free_cpus, &p->cpus_allowed)) { > int cpu, max_cpu = -1; > - u64 max_cap = 0; > + u64 max_cap = 0, min_cap = SCHED_CAPACITY_SCALE * SCHED_CAPACITY_SCALE; > > - for_each_cpu(cpu, later_mask) { > + cpumask_clear(later_mask); > + for_each_cpu(cpu, &tmp_mask) { > u64 cap; > > - if (!dl_task_fit(&p->dl, cpu, &cap)) > - cpumask_clear_cpu(cpu, later_mask); > + if (dl_task_fit(&p->dl, cpu, &cap) && (cap <= min_cap)) { > + if (cap < min_cap) { > + min_cap = cap; > + cpumask_clear(later_mask); > + } > + cpumask_set_cpu(cpu, later_mask); > + } > > if (cap > max_cap) { > max_cap = cap; > -- > 2.20.1 > Thanks, Quentin