Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp605957rwe; Thu, 25 Aug 2022 06:16:20 -0700 (PDT) X-Google-Smtp-Source: AA6agR4j7h0NVBLvMzJSrk40e0ew+mTWG5kG5IyVyGNgadB+Gb4fgZqtzuQfznLXbQ3oiPEv/hzj X-Received: by 2002:a62:1d86:0:b0:52d:9df0:2151 with SMTP id d128-20020a621d86000000b0052d9df02151mr4217393pfd.33.1661433380103; Thu, 25 Aug 2022 06:16:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661433380; cv=none; d=google.com; s=arc-20160816; b=lN/r60fz8nHT1CDLbaznfsI8BpYhkahbsd5fkWtwWrVuADj9j477XjWjpMfaWasUrl f7DPhGrgX/W7SF6Db37m9sFAu0dAJRqPwBQ/9Y7VkLztgIe4m3jHuIqC1j4tVJJqmfWN hwZnD6OrOkm5ilz/BnZOkd9Ofyvfh21z8DJv0AdSEYDA2c/49nMGKE7jA8IKdJRDwZ3x GKTAGW8wrSnH6rvGwOBNkfxqW6TGFgBsE3LbWRxEeob8ggr4ImZ/VqHIYtv9DUfDrGB/ f2yZ2FHln8qrI2cHoFaPhlV0u0z/jtCRUowtNrqUddoIy47U9FtQCkeVFab9xFKtdI2+ HjHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=3bBUsI0/teu1SGpGTa+Jbt56cw9thfDxAuVHauIJcr4=; b=w89marGVnug0UuCXeaBA5HNuyUMCQYR0hFoREt0Dh4kS+AD3zNuUKiCLST/NeFVe2+ p43nL388P4IaFesnoL9QJhKWEQ1wCak+HsN9n9ZUDa1dyohYALbLyHspQqafm/nUhVLS xcCnrLaNTHqJ6ui/ZQuiA9jipqxyA7O0bbzj4gSvJMEajVZULiFSW+lWelK0Am7mH5G2 6fl5Th1ARnjAXdigrOLsaY+afG02uCiqNsJnpxlp8R5kidU06L5sU7THjYcDeLUuMxMQ OmQx4Mt6RP4LVCekadm5i2pLbIHHhHMBWri/Y1YOtG1HSS3Vlm74GQsIgbma01a75F6g O9BA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wDcdvn9n; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o1-20020a170902d4c100b0016ec63b2033si6165907plg.121.2022.08.25.06.16.03; Thu, 25 Aug 2022 06:16:20 -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; dkim=pass header.i=@linaro.org header.s=google header.b=wDcdvn9n; 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=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241106AbiHYM1w (ORCPT + 99 others); Thu, 25 Aug 2022 08:27:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59332 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241057AbiHYM1m (ORCPT ); Thu, 25 Aug 2022 08:27:42 -0400 Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 718EDB2CD1 for ; Thu, 25 Aug 2022 05:27:38 -0700 (PDT) Received: by mail-wr1-x42e.google.com with SMTP id bs25so24426986wrb.2 for ; Thu, 25 Aug 2022 05:27:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=references:in-reply-to:message-id:date:subject:cc:to:from:from:to :cc; bh=3bBUsI0/teu1SGpGTa+Jbt56cw9thfDxAuVHauIJcr4=; b=wDcdvn9n+ukcoBqV1qJlvuH5bk4MBjNC0WGzpX+j68yBvwUlNF45KAf1BfBuI8A4jB adSZf4/KKaWAVAnKxv/HWdUemw/1Uc3nnNBFm3EOmvihVsrAuopXeBjJ+CM4UJ41axnO nL0vIAeOWwV4Q+XsFIBLWjvtBuG0v1bLDkA4PMof6vi6QJh4LVzWSxfGX53J1LqmkNF4 9pb6MMfSgV2OwiFio512IB9WZEf//+LiIgDtAzr44uYjlSBTzt2+D1rVl15fSIeColnF 7ZJs/KvCsSK1xtKBneh4XfdhWw5Lz/+0xud+/FjKc+2XKJMvfi7QpGY4qC+eg1W5Taul fiMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc; bh=3bBUsI0/teu1SGpGTa+Jbt56cw9thfDxAuVHauIJcr4=; b=1YpnnuZXGaU74hv71v8TF/j0mI35UUrWm68dNoc8MiqKS8G/tK2vQn58s0/zr2z/eH V2wAVyJ0Pia2d9Usl+LtPky2g1lmxP94+KkmrzwmeA6VoN52F6lmuMvKhwz14UoSanLp 5G2Y9nLT2hdaZzDfnRGORyzNAMNRCfetviLUoiycAKO+wbb+Rd8AouUojkDhUbyqscpF 5WDMdgPODexmabqNwYwgsmOKdfwkaJFjwRRljcJeQo61rH4k5p2/0fPQ2FOV2pqBJ7BL 41nost3kINEKoYrykeRG4EccXawpG0C3ovrEbGaVLt5DA2DNXPpIhPmiXOKvSy6VyypE ef2g== X-Gm-Message-State: ACgBeo2rKN4t+n7YPi7on5FOK7tRzuF7bzyRINpP3NfF0hPcfb1j7ZnO kB82RFmk5D7ldxhSVOnm4+zJdw== X-Received: by 2002:a5d:64cf:0:b0:220:6d8e:1db0 with SMTP id f15-20020a5d64cf000000b002206d8e1db0mr2081414wri.564.1661430456817; Thu, 25 Aug 2022 05:27:36 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:f:6020:55dd:3519:10d3:b07b]) by smtp.gmail.com with ESMTPSA id c7-20020a05600c0ac700b003a5ee64cc98sm5417809wmr.33.2022.08.25.05.27.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 25 Aug 2022 05:27:35 -0700 (PDT) From: Vincent Guittot To: mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com, dietmar.eggemann@arm.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, Vincent Guittot Subject: [PATCH 3/4] sched/fair: move call to list_last_entry() in detach_tasks Date: Thu, 25 Aug 2022 14:27:25 +0200 Message-Id: <20220825122726.20819-4-vincent.guittot@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20220825122726.20819-1-vincent.guittot@linaro.org> References: <20220825122726.20819-1-vincent.guittot@linaro.org> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED 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 Move the call to list_last_entry() in detach_tasks() after testing loop_max and loop_break. Signed-off-by: Vincent Guittot --- kernel/sched/fair.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 6972a1a29a48..260a55ac462f 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -8047,8 +8047,6 @@ static int detach_tasks(struct lb_env *env) if (env->idle != CPU_NOT_IDLE && env->src_rq->nr_running <= 1) break; - 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 @@ -8065,6 +8063,8 @@ static int detach_tasks(struct lb_env *env) break; } + p = list_last_entry(tasks, struct task_struct, se.group_node); + if (!can_migrate_task(p, env)) goto next; -- 2.17.1