Received: by 2002:a05:7412:b101:b0:e2:908c:2ebd with SMTP id az1csp3058121rdb; Wed, 15 Nov 2023 21:08:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IGmqWKBPvdFmjvUuge4jttqbh3uyoMkEocuBGULU2HXKIoFQRQrc+vBUI1KN3aSakkzvC+l X-Received: by 2002:a05:6e02:160b:b0:359:417b:50de with SMTP id t11-20020a056e02160b00b00359417b50demr24572878ilu.15.1700111286116; Wed, 15 Nov 2023 21:08:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700111286; cv=none; d=google.com; s=arc-20160816; b=KX33RRBp7MjrwdYnrQxDcdqgoAiYLXgwH0AJ09cTW8xlrzyFlu6DIwHy3Jd+RgHF66 /BPVKI0jEI0aquJleq3bmGlonekOzu+iMCZalSP5wQlpl+ChBiqOhTo0u6voDG8pXYAD VbX8Rho+PVEbvXNuWjNzNW9QsW2D8K0dhzgtXU3e0lJm3kGNJtkriAOqt+w6wfcnP5jB SHVSVlqEBhGK58Gp7AwlTTel3X7LJmXZ9NaE7SeJ36O+SweT9ssBR4U4RY0S7XeHagXN 5FP8KwKOoiGnAikTgDMCwqXkpPTZyeBw7pcVwuYF0wvplRjfXJqSy4XJXX/+IM7jLyJA XBrA== 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:references :cc:to:from:content-language:subject:user-agent:mime-version:date :message-id:dkim-signature; bh=PDtFNHWifzh6E6PZ2URvx5k5OrUkdcSzyx6lrGeB52g=; fh=v7tmjTq3HKvG+9Mt1/P693nb5d87+reN5OFh5easFgI=; b=i/S1F+rPxlB+CYvpmyKqyCoNpfZDiPI+rn9e3rNx6Xh3ea4DLur4QY/22+qXhrJ2QD gMViho6rPo31D8ieREKgQf18LPSfP/iH/sYFnfgghd8lzS8LxfkJ2cbBbXtB7Y8FA/qQ N5U5U7aI3Uri0bHmXWe3fCtvAytVtreMphR1ba55Wkdvq+/UlRug2cey7+rBbNAvOZCP BsyjbRAEqHO+k4xUjAPGM7ikizsAb4AZ3Ke09D0MWpZmAhd6lE9cjgS1u89LMer6CSbg 6PWC3OYZjVrhZOK4P182PQ293AAkABB0h8WznBRE9lcmJiYw25Fy7IP8lJNgVSosb16r Irfw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=gIBbCC0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id k64-20020a636f43000000b005b896ecd1efsi11568649pgc.172.2023.11.15.21.08.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 21:08:06 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@bytedance.com header.s=google header.b=gIBbCC0a; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=bytedance.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 8995B812D22B; Wed, 15 Nov 2023 21:08:04 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344822AbjKPFH4 (ORCPT + 99 others); Thu, 16 Nov 2023 00:07:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37870 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344719AbjKPFHz (ORCPT ); Thu, 16 Nov 2023 00:07:55 -0500 Received: from mail-oa1-x35.google.com (mail-oa1-x35.google.com [IPv6:2001:4860:4864:20::35]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F34E0130 for ; Wed, 15 Nov 2023 21:07:27 -0800 (PST) Received: by mail-oa1-x35.google.com with SMTP id 586e51a60fabf-1f0f160e293so229133fac.0 for ; Wed, 15 Nov 2023 21:07:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bytedance.com; s=google; t=1700111247; x=1700716047; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=PDtFNHWifzh6E6PZ2URvx5k5OrUkdcSzyx6lrGeB52g=; b=gIBbCC0a/o8HbUNPZiz6shZEEiFQmo7vYAgDLjL7K3SHWO9IXefVQR4T/hSYCX3596 JrmTDysakN/tZXmWWmuSeAvCNRNFkM0tOMAN9XhTjm+pi1D31tjG8Xc48hdpuvVheK53 eQ1rRDUiFBgdh5ZAL9LmLaJEjljjjf1LMvFUDp+omvKPYrlSo0KonzZ5iFsTGEnQ+UXK p9ZoB/TlCtmfDhQ+d1wIUeZx/SMm7XtGL5KSSy9MMAQC9/muJ/psfoiNp3oBPmKEydn6 nJUMu8RA02svCGlC5sf3TPip78h/IIDAgG90vFABpxjXGZmNYcU1FMQGM6qYosJLuhDp bcuw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700111247; x=1700716047; h=content-transfer-encoding:in-reply-to:references:cc:to:from :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PDtFNHWifzh6E6PZ2URvx5k5OrUkdcSzyx6lrGeB52g=; b=farEFT6sDF3H1wHwE6+uvpOg/iih5iIVqfC+zjdpiuVMgJEQrH8qonLq8eJL4vhN6o Bs3cBV4ioU/P8Ip5xmvhtCW1p86hRpR5zwKfr2Q+tuHFrFF1er2zxdOe4XesazTlaIcw hrNPSQc0BFddxc5jHSwdCHCTPB+vVPFE5aPAeSC+qk7VkybAsLkd98VVOGafA9pofyXZ 5huOV9wja4kM9a98ssjMkEzUY3tjW7dpKZYY3NOhN9fYxyWVw3695qgviTb5pk8UTTug C8nl1y+JSGC9qMkkq+9oBZg46/rnK0YSSQXbVZM9rwlspj7fkhTGXwB+AtrwQovcLOEG 6rDA== X-Gm-Message-State: AOJu0YzR/V9nWa6GbYwLdrKbtjQQBxTtl5mMJxNg+flmQdwTS4OrVYoS tzRT2+J+YMu+o15kqSqpwzfmOQ== X-Received: by 2002:a05:6870:819e:b0:1ea:30b2:3fcc with SMTP id k30-20020a056870819e00b001ea30b23fccmr19801235oae.31.1700111247264; Wed, 15 Nov 2023 21:07:27 -0800 (PST) Received: from [10.254.46.51] ([139.177.225.228]) by smtp.gmail.com with ESMTPSA id n4-20020a056a0007c400b006c4d47a7668sm3652987pfu.127.2023.11.15.21.07.20 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 15 Nov 2023 21:07:26 -0800 (PST) Message-ID: <19c6accf-1cc0-489d-9c82-e0ddf982b098@bytedance.com> Date: Thu, 16 Nov 2023 13:07:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 1/4] sched/eevdf: Fix vruntime adjustment on reweight Content-Language: en-US From: Abel Wu To: Yiwei Lin Cc: Barry Song <21cnbao@gmail.com>, Benjamin Segall , Chen Yu , Daniel Jordan , "Gautham R . Shenoy" , Joel Fernandes , K Prateek Nayak , Mike Galbraith , Qais Yousef , Tim Chen , Yicong Yang , Youssef Esmat , linux-kernel@vger.kernel.org, Peter Zijlstra , Ingo Molnar , Vincent Guittot , Dietmar Eggemann , Valentin Schneider References: <20231107090510.71322-1-wuyun.abel@bytedance.com> <20231107090510.71322-2-wuyun.abel@bytedance.com> <23cebdf8-1a51-481e-a8c2-e17021099e05@bytedance.com> In-Reply-To: <23cebdf8-1a51-481e-a8c2-e17021099e05@bytedance.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit 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_BLOCKED, SPF_HELO_NONE,SPF_NONE,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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 21:08:04 -0800 (PST) On 11/16/23 12:48 PM, Abel Wu Wrote: > On 11/15/23 11:36 PM, Yiwei Lin Wrote: >> >>> @@ -3712,8 +3811,17 @@ static void reweight_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, >>>       enqueue_load_avg(cfs_rq, se); >>>       if (se->on_rq) { >>>           update_load_add(&cfs_rq->load, se->load.weight); >>> -        if (cfs_rq->curr != se) >>> -            avg_vruntime_add(cfs_rq, se); >>> +        if (!curr) { >>> +            /* >>> +             * The entity's vruntime has been adjusted, so let's check >>> +             * whether the rq-wide min_vruntime needs updated too. Since >>> +             * the calculations above require stable min_vruntime rather >>> +             * than up-to-date one, we do the update at the end of the >>> +             * reweight process. >>> +             */ >>> +            __enqueue_entity(cfs_rq, se); >>> +            update_min_vruntime(cfs_rq); >>> +        } >>>       } >>>   } >> Sorry if I am asking stupid question...... It looks like reweight_entity() may have chance to change the weight of cfs_rq->curr entity, but we'll never update_min_vruntime() when reweighting it. Is there any reason that we can skip the update_min_vruntime() for this case? > > No, you are right! I was intended to update_min_vruntime() if se->on_rq and no matter it is curr or not, just as you suggested. But after a second thought I wonder if it is necessary to update *NOW*, since we will always update_curr() before making any change to cfs_rq. Thoughts?