Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp317970pxy; Wed, 21 Apr 2021 03:55:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzPwK21W32V7o3CDGLnTeKe5ObGIGwA3DE/VRG1iuRvIZI58Rh2510LLy8zGgmFcl/tDIwx X-Received: by 2002:a63:ce03:: with SMTP id y3mr20973480pgf.414.1619002515191; Wed, 21 Apr 2021 03:55:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619002515; cv=none; d=google.com; s=arc-20160816; b=cLc6WHvtiH6aFLbIcq14J4qi0P8ccSOFE2E1XPPVGOyn0Vbzuq5O/WLJl6R455BSUU rjmSWB4BrFXTZrduvjah41HS5N4F0EQYiBIZ8CDNWfrkdXe/TTIkYJl451W0AVoPjuEq PSPC7RuedoLFYw/jQMtiwIEjeKLSjaZvx2aaeBqKCA63m51U9SRWS15Zamegx3BdeOjp rxemiA7p+Darwm6uYd67qsLGe3lX7jbqqFGGO8APT5QR1RGqoy4irI/Ms4+A7GYW2jRl U6X1H0H1bncI44tuwA/+BV8fZrQWDMv/dieQkjrKPuWfo7A7jdAW3spjxbIPGR8M6VyS OGcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from; bh=MvEpt1GDY9NGzK65/WM7241h5ZakMyfbTbPu7kSIu3Y=; b=YFadpjRSxwbLEOolQz5/l9JBfT29tSnQjfQuxbDzl84FEOParGbtCVD5qITRKrR8Ha URgw2Jmpa3wgyP5LfoMDQnlXhA46J0CZR+Zb91DOgGSqoB624Sv+Gdad7hoOWNSCH6Lr dnzEwNob1io7zLHq/aU0slybc56F7koOSRkFfGRwvNnAUsg1DyzisuS2NJbyRBWnZ46G q7BUPD117lH8XoDMOZ9+5lSk49ejB6mmTrl2g9925bhMLK7qNppaEMJ89cNU6JSlvxp7 smnzpVlDmkgTGxZdSGWtow42yCg/+wkWgbQdCtrMV5mSUp1z5UTDICEWZ2hyde4NWcil mZrg== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si2091409pfr.87.2021.04.21.03.55.03; Wed, 21 Apr 2021 03:55:15 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235435AbhDUKxQ convert rfc822-to-8bit (ORCPT + 99 others); Wed, 21 Apr 2021 06:53:16 -0400 Received: from foss.arm.com ([217.140.110.172]:59200 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234632AbhDUKxN (ORCPT ); Wed, 21 Apr 2021 06:53:13 -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 448F7113E; Wed, 21 Apr 2021 03:52:40 -0700 (PDT) Received: from e113632-lin (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id CCD903F73B; Wed, 21 Apr 2021 03:52:38 -0700 (PDT) From: Valentin Schneider To: Vincent Guittot Cc: linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Dietmar Eggemann , Morten Rasmussen , Qais Yousef , Quentin Perret , Pavan Kondeti , Rik van Riel , Lingutla Chandrasekhar Subject: Re: [PATCH 2/2] sched/fair: Relax task_hot() for misfit tasks In-Reply-To: References: <20210415175846.494385-1-valentin.schneider@arm.com> <20210415175846.494385-3-valentin.schneider@arm.com> <20210416135113.GA16445@vingu-book> <87blaakxji.mognet@arm.com> Date: Wed, 21 Apr 2021 11:52:36 +0100 Message-ID: <878s5bvrij.mognet@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/04/21 16:33, Vincent Guittot wrote: > On Mon, 19 Apr 2021 at 19:13, Valentin Schneider > wrote: >> >> On 16/04/21 15:51, Vincent Guittot wrote: >> > Le jeudi 15 avril 2021 � 18:58:46 (+0100), Valentin Schneider a �crit : >> >> + >> >> +/* >> >> + * What does migrating this task do to our capacity-aware scheduling criterion? >> >> + * >> >> + * Returns 1, if the task needs more capacity than the dst CPU can provide. >> >> + * Returns 0, if the task needs the extra capacity provided by the dst CPU >> >> + * Returns -1, if the task isn't impacted by the migration wrt capacity. >> >> + */ >> >> +static int migrate_degrades_capacity(struct task_struct *p, struct lb_env *env) >> >> +{ >> >> + if (!(env->sd->flags & SD_ASYM_CPUCAPACITY)) >> >> + return -1; >> >> + >> >> + if (!task_fits_capacity(p, capacity_of(env->src_cpu))) { >> >> + if (cpu_capacity_greater(env->dst_cpu, env->src_cpu)) >> >> + return 0; >> >> + else if (cpu_capacity_greater(env->src_cpu, env->dst_cpu)) >> >> + return 1; >> >> + else >> >> + return -1; >> >> + } >> > >> > Being there means that task fits src_cpu capacity so why testing p against dst_cpu ? >> > >> >> Because if p fits on src_cpu, we don't want to move it to a dst_cpu on >> which it *doesn't* fit. > > OK. I was confused because I thought that this was only to force > migration in case of group_misfit_task but you tried to extend to > other cases... I'm not convinced that you succeeded to cover all cases > > Also I found this function which returns 3 values a bit disturbing. > IIUC you tried to align to migrate_degrades_capacity but you should > have better aligned to task_hot and return only 0 or 1. -1 is not used > Ack, will do. >> >> @@ -7672,6 +7698,15 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) >> >> if (tsk_cache_hot == -1) >> >> tsk_cache_hot = task_hot(p, env); >> >> >> >> + /* >> >> + * On a (sane) asymmetric CPU capacity system, the increase in compute >> >> + * capacity should offset any potential performance hit caused by a >> >> + * migration. >> >> + */ >> >> + if ((env->dst_grp_type == group_has_spare) && >> > >> > Shouldn't it be env->src_grp_type == group_misfit_task to only care of misfit task case as >> > stated in $subject >> > >> >> Previously this was env->idle != CPU_NOT_IDLE, but I figured dst_grp_type >> could give us a better picture. Staring at this some more, this isn't so >> true when the group size goes up - there's no guarantees the dst_cpu is the >> one that has spare cycles, and the other CPUs might not be able to grant >> the capacity uplift dst_cpu can. > > yeah you have to keep checking for env->idle != CPU_NOT_IDLE > >> >> As for not using src_grp_type == group_misfit_task, this is pretty much the >> same as [1]. CPU-bound (misfit) task + some other task on the same rq >> implies group_overloaded classification when balancing at MC level (no SMT, >> so one group per CPU). > > Is it something that happens often or just a sporadic/transient state > ? I mean does it really worth the extra complexity and do you see > performance improvement ? > "Unfortunately" yes, this is a relatively common scenario when running "1 big task per CPU" types of workloads. The expected behaviour for big.LITTLE systems is to upmigrate tasks stuck on the LITTLE CPUs as soon as a big CPU becomes free, usually via newidle balance (which, since they process work faster than the LITTLEs, is bound to happen), and an extra task being enqueued at "the wrong time" can prevent this from happening. This usually means a misfit task can take a few dozen extra ms than it should to be migrated - in the tests I run (which are pretty much this 1 hog per CPU workload) this happens about ~20% of the time. > You should better focus on fixing the simple case of group_misfit_task > task. This other cases looks far more complex with lot of corner cases > >> >> [1]: http://lore.kernel.org/r/jhjblcuv2mo.mognet@arm.com