Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp1568681pxa; Thu, 6 Aug 2020 10:28:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyeXc8sVJvQ7I/NM5vq44kb7QzlaMxlJL+4/v0Nn3zBBotM/kJF2WK+h/1xnGJdTQqCB+SY X-Received: by 2002:a17:907:385:: with SMTP id ss5mr5234470ejb.496.1596734899883; Thu, 06 Aug 2020 10:28:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596734899; cv=none; d=google.com; s=arc-20160816; b=E96UBAQ/HxeUOPJVSmTAtSoumqarWj6jLKTSWnykOP3lUzgzeAAHI49FppW4YNjs1G TguQlK56ZKpoLcR3LtwK6yeN/ONQEy9mAEF7XCk1snF6mBR6k7mo4IT0td9CW9OP/JKh Y8vEuhq+GiSBPOxzzWO/Us8WxvXXpULa9D+Dn4pQElSM2DgcklBbgQYSA/mIIc8U+KIj MYeygDTtaC4LQHBI/wQpEPxkBfbFNgguwiF/gDrQpHZuYoWc/ojx0wmSufoRbY8PA0+j 1bp/bgbNinIpxcF0Tjnq4fH0Cnpich0V/6RblSdUeewE7HLmo3egW2OzP419lb4jefeG g9SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=nn4z2y5BaScdXkelcHGClRqwR2TeRl0jPHdLo5gNvko=; b=cV3CQdcmbYi8E4hiy0cXMoAFnFrU4qN5U1iBlEpgGxO9W3ioFCylasQVTkZjpoMcSq RRF7Tv40PE2d6Zf9vhWW05xvk/fVe3gPVeahnnv/3kGdpOSw4PbyupKkOYma/nyMvKQQ UAOyOHDiDYQ8jwBvmBEZgv11UqKa1ZgYuAGhVJTG5uGiNjBj/+y82QIjeQuC0iZ4ujjs KI27KceQYyoLTEC7VPzbV7o6LC9PV2TXffOfvwadTT5TyRpmUFjtM0fktt1l8KVNTjyN AwOgMSRsVE979gYqmWgC+sT/arEIqS5M1dVAyI57gja50oix5xn7SXZVSAYEOSm16/zm wzRg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t23si3832108edc.163.2020.08.06.10.27.57; Thu, 06 Aug 2020 10:28:19 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730206AbgHFR1i (ORCPT + 99 others); Thu, 6 Aug 2020 13:27:38 -0400 Received: from foss.arm.com ([217.140.110.172]:45934 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729265AbgHFR1f (ORCPT ); Thu, 6 Aug 2020 13:27:35 -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 DFDE911B3; Thu, 6 Aug 2020 07:48:56 -0700 (PDT) Received: from [192.168.178.2] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 3C8F43F887; Thu, 6 Aug 2020 07:48:52 -0700 (PDT) Subject: Re: [PATCH RFC] sched/fair: simplfy the work when reweighting entity To: =?UTF-8?B?YmVuYmppYW5nKOiSi+W9qik=?= Cc: Jiang Biao , "mingo@redhat.com" , Peter Zijlstra , "juri.lelli@redhat.com" , "vincent.guittot@linaro.org" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" , "linux-kernel@vger.kernel.org" References: <20200804071222.31675-1-benbjiang@tencent.com> <8FA38F12-3CB4-46A9-B654-92DC384D3103@tencent.com> From: Dietmar Eggemann Message-ID: Date: Thu, 6 Aug 2020 16:48:50 +0200 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: <8FA38F12-3CB4-46A9-B654-92DC384D3103@tencent.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 06/08/2020 04:42, benbjiang(蒋彪) wrote: > > >> On Aug 6, 2020, at 12:21 AM, Dietmar Eggemann wrote: >> >> On 04/08/2020 09:12, Jiang Biao wrote: >>> If a se is on_rq when reweighting entity, all we need should be >>> updating the load of cfs_rq, other dequeue/enqueue works could be >>> redundant, such as, >>> * account_numa_dequeue/account_numa_enqueue >>> * list_del/list_add from/into cfs_tasks >>> * nr_running--/nr_running++ >> >> I think this could make sense. Have you spotted a code path where this >> gives you a change? >> >> I guess only for a task on the rq, so: entity_is_task(se) && se->on_rq > Yes, you're right. No other code path I spotted except what you list below. > >> >>> Just simplfy the work. Could be helpful for the hot path. >> >> IMHO hotpath is update_cfs_group() -> reweight_entity() but this is only >> called for '!entity_is_task(se)'. >> >> See >> >> 3290 if (!gcfs_rq) >> 3291 return; >> >> in update_cfs_group(). > Yes, It is. > But *nr_running--/nr_running++* works are still redundant for > ‘!entity_is_task(se)' hot path. :) True. > Besides, I guess we could simplify the logic and make it cleaner and > more readable with this patch. Yes. > If it could make sense to you, would you mind if I resend the patch > with the commit log amended? LGTM so why not? >> The 'entity_is_task(se)' case is >> >> set_load_weight(struct task_struct *p, ...) -> reweight_task(p, ...) -> >> reweight_entity(..., &p->se, ...) >> >> but here !se->on_rq. > Yes, indeed. [...]