Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp225017pxf; Wed, 17 Mar 2021 03:55:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy2JUdJt6XoI1FcalV261VA/61WzRHIJIytkdav4nDKZT07ztCur9alf2U0FPlTp/IJGCms X-Received: by 2002:a05:6402:312b:: with SMTP id dd11mr41449832edb.149.1615978546026; Wed, 17 Mar 2021 03:55:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1615978546; cv=none; d=google.com; s=arc-20160816; b=osu/5Y0Nmp6D8DiOBm9VW5yC1+eZnvNrfmxyqdjTlmEz4ZZMSTENDeI6+XN8KaQKy9 0dBnPXgziyr3fzfe75iCHAsLNKOf+InlNJ3O34GRTUi43onjnQJBcZMM5XDMgE5VNJUQ 863KQSW+EADD20hC3YOHCl4JL2TJn0PbBlaQwiXA+VEpO6L2E101dMUjvvuuBBNBPfkX qkAu9B/C8iN6s8ygymVJf/QQMtsr1zL9V0H1bgt81CcUsMTOd2AvUwn/TgxJP7UAWg2u mshuovpFd0Q3oLfx/ho28WyM6rExwiFKoFwxtWXDdqeC3EGxUNAaJIfytWvj2Kt+6LNT eb/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=Vyz7PaJDUnQV5eewLPVBUg3tT9Vj4RZZrX6qvTIlV8A=; b=mp/HVkR1g7S6GNV6t4xaraZZJA5R1ZoR5J8UEr9e1Q6/ZuFKCQTc0yubI1p3E4YZLZ GNg0U/zIv+ehI94at7mhwcy5b84Yj3rCXI6/XPY4A4eVkGndVVxdFOH+le7lPP/i6tIv ezlzOg8Aa6DdkYg0sHjDsCPFhAJPCiN5vQieWcf+dEUYONcfbM+hNutz4sBf+tfpl0Hq nFV5gh00NbpU9MA/CTCmqi+8PXyVKj7dw0f3DTaBL+jLNU1pyS4m15qBhzKDzGQcWQCo zpexr89IQJHwDFbYSh8DF8Ac5jBM8TYsdVrs/w520IELL46cj5i4J+NOmBJc/ViFKTID JHjw== 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 pw11si16059338ejb.2.2021.03.17.03.55.23; Wed, 17 Mar 2021 03:55:46 -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 S229952AbhCQKwd (ORCPT + 99 others); Wed, 17 Mar 2021 06:52:33 -0400 Received: from foss.arm.com ([217.140.110.172]:56958 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230439AbhCQKwO (ORCPT ); Wed, 17 Mar 2021 06:52:14 -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 C535DD6E; Wed, 17 Mar 2021 03:52:13 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F14463F70D; Wed, 17 Mar 2021 03:52:11 -0700 (PDT) Subject: Re: [PATCH v3 2/7] sched/fair: Clean up active balance nr_balance_failed trickery To: Valentin Schneider , linux-kernel@vger.kernel.org Cc: Peter Zijlstra , Ingo Molnar , Vincent Guittot , Morten Rasmussen , Qais Yousef , Quentin Perret , Pavan Kondeti , Rik van Riel , Lingutla Chandrasekhar References: <20210311120527.167870-1-valentin.schneider@arm.com> <20210311120527.167870-3-valentin.schneider@arm.com> From: Dietmar Eggemann Message-ID: <76133a77-3098-5bb4-cdae-060d2e4b93c9@arm.com> Date: Wed, 17 Mar 2021 11:52:06 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.10.0 MIME-Version: 1.0 In-Reply-To: <20210311120527.167870-3-valentin.schneider@arm.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/03/2021 13:05, Valentin Schneider wrote: [...] > @@ -9952,7 +9954,8 @@ static int active_load_balance_cpu_stop(void *data) > * @dst_grpmask we need to make that test go away with lying > * about DST_PINNED. > */ > - .flags = LBF_DST_PINNED, > + .flags = LBF_DST_PINNED | > + LBF_ACTIVE_LB, Since you now have a dedicated LBF flag for active balancing you could remove the LBF_DST_PINNED here and adapt the if condition in can_migrate_task(): diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f50a902bdf24..9f7feb512016 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7583,10 +7583,13 @@ int can_migrate_task(struct task_struct *p, struct lb_env *env) * meet load balance goals by pulling other tasks on src_cpu. * * Avoid computing new_dst_cpu for NEWLY_IDLE or if we have - * already computed one in current iteration. + * already computed one in current iteration or if it is an + * active balance. */ - if (env->idle == CPU_NEWLY_IDLE || (env->flags & LBF_DST_PINNED)) + if (env->idle == CPU_NEWLY_IDLE || + (env->flags & (LBF_DST_PINNED | LBF_ACTIVE_LB))) { return 0; + } /* Prevent to re-select dst_cpu via env's CPUs: */ for_each_cpu_and(cpu, env->dst_grpmask, env->cpus) { @@ -9948,14 +9951,7 @@ static int active_load_balance_cpu_stop(void *data) .src_cpu = busiest_rq->cpu, .src_rq = busiest_rq, .idle = CPU_IDLE, - /* - * can_migrate_task() doesn't need to compute new_dst_cpu - * for active balancing. Since we have CPU_IDLE, but no - * @dst_grpmask we need to make that test go away with lying - * about DST_PINNED. - */ - .flags = LBF_DST_PINNED | - LBF_ACTIVE_LB, + .flags = LBF_ACTIVE_LB, };