Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp886360imm; Fri, 13 Jul 2018 07:58:57 -0700 (PDT) X-Google-Smtp-Source: AAOMgpdpIdA2xTCLZzpfStuZ0WSNeNjPnR4gbhD/XeM0OrD2aCvOcdZ5AholWWFHhuFr/a8Bv0f8 X-Received: by 2002:a63:66c7:: with SMTP id a190-v6mr6344480pgc.411.1531493937530; Fri, 13 Jul 2018 07:58:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531493937; cv=none; d=google.com; s=arc-20160816; b=EJ7iqOfWF4JU8evhHiezKaZ8vzjo22ZcbPnt+/OJRbUyCPIEelGuWI6LzKH7KFNxQM fWxgPUupndOwqMpOcakGfHCFtQnSCWhaFqKawvljXKp4cLPLShVsmDmu4Ka/gcBUnTqy LpHB7eovskoapXS4DctCv8twtXhxl+TtKUliT+6m/PXtaHlE4q39zCo3ltzFYrslV/au ihhN8KJdOtG9rR4gL2KggQgIsPSRHUutnCKCKEablgZ5+xrFnKe3Z+vF89VH+3mQWMOS FSvILBmE4VznfeaP7ryooBCt7k+6Bp444JaMPpI+Z5T2h1sG7b/3D6c5Ig3A2KGlkcuZ Od3Q== 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:arc-authentication-results; bh=IX5u8Fm0g/Ckf0xPSDW28VP8etHgYzGNZDZrTviyFRM=; b=ZTHpBCnW1Nqizkg05GYs8ngUFELtZw+JqtTYgQXfJCzSQTdovV/IfyqcOZu4bolQTU 32nSesHN2WJLBXzMzeDY7WCpUOcKkO6kgiqLhrTagZovmkxYpaze8HLfO0vLimq01VkE +y6Mp7gz1XSMAuZiSXgaT8BOGMTYVc+oZSE9fWoGo+hn9V6EbI4iHWAjseFofHKAGfPJ zVEMAovzxN9/nVIWDQPyDBBSApLzZ61LmuwrePBXcMSzBQi84amXXSEjy4Q5BhvmpkeR lXoMGTXMIItBJW/7c1QJYGmUVmtdKlwIGr+kpKbChpxU0ss2Bhr9iXUrJR9attf0mka/ D4og== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u1-v6si15120163plk.97.2018.07.13.07.58.41; Fri, 13 Jul 2018 07:58:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729779AbeGMPMv (ORCPT + 99 others); Fri, 13 Jul 2018 11:12:51 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:36368 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729647AbeGMPMv (ORCPT ); Fri, 13 Jul 2018 11:12:51 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 6F7B57A9; Fri, 13 Jul 2018 07:57:51 -0700 (PDT) Received: from [0.0.0.0] (e107985-lin.cambridge.arm.com [10.1.210.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 0130B3F5B1; Fri, 13 Jul 2018 07:57:48 -0700 (PDT) Subject: Re: [PATCH] sched/fair: Remove setting task's se->runnable_weight during PELT update To: Joel Fernandes Cc: Peter Zijlstra , Ingo Molnar , Vincent Guittot , Morten Rasmussen , Patrick Bellasi , Quentin Perret , kernel-team@android.com, Joel Fernandes , linux-kernel@vger.kernel.org References: <20180709164753.24699-1-dietmar.eggemann@arm.com> <20180710230917.GA187293@joelaf.mtv.corp.google.com> <0aba9bb6-eec7-130e-373f-5f87f192f2d4@arm.com> <20180712081722.GB154647@joelaf.mtv.corp.google.com> From: Dietmar Eggemann Message-ID: Date: Fri, 13 Jul 2018 16:57:46 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180712081722.GB154647@joelaf.mtv.corp.google.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 07/12/2018 10:17 AM, Joel Fernandes wrote: > On Wed, Jul 11, 2018 at 10:43:28AM +0200, Dietmar Eggemann wrote: >> On 07/11/2018 01:09 AM, Joel Fernandes wrote: >>> On Mon, Jul 09, 2018 at 05:47:53PM +0100, Dietmar Eggemann wrote: >>>> A CFS (SCHED_OTHER, SCHED_BATCH or SCHED_IDLE policy) task's >>>> se->runnable_weight must always be in sync with its se->load.weight. >>>> >>>> se->runnable_weight is set to se->load.weight when the task is >>>> forked (init_entity_runnable_average()) or reniced (reweight_entity()). >>>> >>>> There are two cases in set_load_weight() which since they currently only >>>> set se->load.weight could lead to a situation in which se->load.weight >>>> is different to se->runnable_weight for a CFS task: >>>> >>>> (1) A task switches to SCHED_IDLE. >>>> >>>> (2) A SCHED_FIFO, SCHED_RR or SCHED_DEADLINE task which has been reniced >>>> (during which only its static priority gets set) switches to >>>> SCHED_OTHER or SCHED_BATCH. >>>> >>>> Set se->runnable_weight to se->load.weight in these two cases to prevent >>>> this. This eliminates the need to explicitly set it to se->load.weight >>>> during PELT updates in the CFS scheduler fastpath. >>> >>> Looks good to me. By the way just asking, is there a chance where >>> se_weight(se) and se_runnable(se) can ever be different? >> >> Yes they can be different, not for a task though but for se's representing >> task groups. It got introduced to be able to propagate load and runnable >> load independently through the task groups hierarchies. > > I know that task-group se has different values. I was saying for task ses, > the extra division can be skipped possibly improving performance (if at all). Ah, OK, I didn't pay attention to the '... if the sa belongs to the task:' part. Since ___update_load_sum() is either called with !!se->on_rq or 0 for both ('load' and 'runnable'), sa->load_sum and sa->runnable_load_sum should be equal for a task. And since se_weight(se) and se_runnable(se) for 'load' and 'runnable' of ___update_load_avg() are the same for a task, sa->load_avg and sa->runnable_load_avg should be also equal for a task. You would have to pass the information that sa belongs to a se and not to a cfs_rq into ___update_load_avg() though to be able to use entity_is_task(). [...]