Received: by 2002:a05:6358:489b:b0:bb:da1:e618 with SMTP id x27csp4955883rwn; Mon, 12 Sep 2022 01:51:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4jBMOQJM22IYoVKiibKM1Ufni/ibSkG/hkxB7XUJ7zWokD1Zg3iUDjSrTwgFeyCiV+AH45 X-Received: by 2002:a17:90a:a407:b0:202:e6eb:4b7c with SMTP id y7-20020a17090aa40700b00202e6eb4b7cmr336526pjp.15.1662972679871; Mon, 12 Sep 2022 01:51:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662972679; cv=none; d=google.com; s=arc-20160816; b=VybfWfjMcnZPV7UjyV0paDBb0fG0E5P9LfKpRyz2QtrtPjUjzuwi25ji/ZvAxt0DTJ /ttU/Yd9AgboTRoI/Fyz6xF4i1TaIgLLXddxjRLcBClB3azxUt/5JFVnyPiEIou0tUZ1 X0Za8JJGFWD+uscjwgQWhiNcHLxZzdK1gAD93QGVwskvmoOTrIpVj76OxGrsnDLOX1jC 9NRtwZqp3AeUWtgmBntJxaXUQJYkK8hXlYZbXBQVwNqZcKx3lLLTCWsd+XAEmjFIbLEe GCnG5CKx7MAiD9gHfCCyYziz6jthHXRtAA5zAtjtLQBZiqnbUICd+YvCfDLPVKFCuXpP 1wrg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=ACv78et/f5YdAR6uEOGhZKGbkkI596r8Mkzz8uWiCtY=; b=WEVlSl41uQ9Tk5otueeRirdqEIozD7mGadnz7ZevdCx7NM/ZSPcmTZXISyABzI91cy VX0Ab7KAImMNZDREUrjB4SBq5C35eYTGttixErwFyV7hj4dbnnWsTGO5ml1TDsJyMR5i 77jasNR95vd1u0jT2j15+xc0iovCzUd2afXZ9DkIQcIH0H8w2fbXBcLQDMafN+AykJWo T+gBERlC0C1NCvbOJuXUujKErc+jY6I0LyN3Ze0RuwfP4H0SWd859loP7/9se5IbR+M3 aWs512YCH5HdoazKHWOgBN0Im769o65WfhFx5E8jbixk8bGyAJAOs/BTwBOcBlKEsS16 RzHA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pb12-20020a17090b3c0c00b001fd67532e5dsi8127787pjb.181.2022.09.12.01.51.06; Mon, 12 Sep 2022 01:51:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S229643AbiILIoj (ORCPT + 99 others); Mon, 12 Sep 2022 04:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44374 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229633AbiILIoh (ORCPT ); Mon, 12 Sep 2022 04:44:37 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id B988B6385 for ; Mon, 12 Sep 2022 01:44:34 -0700 (PDT) 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 D9AC2113E; Mon, 12 Sep 2022 01:44:40 -0700 (PDT) Received: from [172.16.16.241] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id DEF523F73D; Mon, 12 Sep 2022 01:44:32 -0700 (PDT) Message-ID: Date: Mon, 12 Sep 2022 10:44:15 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.9.1 Subject: Re: [PATCH 1/4] sched/fair: make sure to try to detach at least one movable task Content-Language: en-US To: Vincent Guittot , mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com, vschneid@redhat.com, linux-kernel@vger.kernel.org Cc: zhangqiao22@huawei.com References: <20220825122726.20819-1-vincent.guittot@linaro.org> <20220825122726.20819-2-vincent.guittot@linaro.org> From: Dietmar Eggemann In-Reply-To: <20220825122726.20819-2-vincent.guittot@linaro.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.1 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_HI,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 25/08/2022 14:27, Vincent Guittot wrote: s/sched/fair: make/sched/fair: Make > During load balance, we try at most env->loop_max time to move a task. > But it can happen that the loop_max LRU tasks (ie tail of > the cfs_tasks list) can't be moved to dst_cpu because of affinity. > In this case, loop in the list until we found at least one. > > The maximum of detached tasks remained the same as before. Not sure how this relates to the patch? Isn't this given by the `env->imbalance <= 0` check at the end of detach_tasks()? > > Signed-off-by: Vincent Guittot > --- > kernel/sched/fair.c | 12 +++++++++--- > 1 file changed, 9 insertions(+), 3 deletions(-) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index da388657d5ac..02b7b808e186 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -8052,8 +8052,12 @@ static int detach_tasks(struct lb_env *env) > p = list_last_entry(tasks, struct task_struct, se.group_node); > > env->loop++; > - /* We've more or less seen every task there is, call it quits */ > - if (env->loop > env->loop_max) > + /* > + * We've more or less seen every task there is, call it quits I never understood this `more or less`. Either we have seen all tasks or not? > + * unless we haven't found any movable task yet. > + */ > + if (env->loop > env->loop_max && > + !(env->flags & LBF_ALL_PINNED)) > break; > > /* take a breather every nr_migrate tasks */ > @@ -10182,7 +10186,9 @@ static int load_balance(int this_cpu, struct rq *this_rq, > > if (env.flags & LBF_NEED_BREAK) { > env.flags &= ~LBF_NEED_BREAK; > - goto more_balance; > + /* Stop if we tried all running tasks */ Would say s/running/runnable but I see that we do use running/runnable interchangeably. > + if (env.loop < busiest->nr_running) > + goto more_balance; > } > > /* IMHO, there will be some interaction with the `All tasks on this runqueue were pinned by CPU affinity` check at the end of load_balance()?