Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp815314ybi; Wed, 19 Jun 2019 08:18:51 -0700 (PDT) X-Google-Smtp-Source: APXvYqz3nHLQ4nQO6AfX0jG/5ZZNkwnSDqGeiLHMGgBPYuutsAD8rIz9NuKiFUK9ufhXvK+Dk6fW X-Received: by 2002:a17:902:4481:: with SMTP id l1mr122060894pld.121.1560957530992; Wed, 19 Jun 2019 08:18:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560957530; cv=none; d=google.com; s=arc-20160816; b=VoE2ntYI9RTYtQCV1Spst268VzLbY+caF3E4hE9oNnSJsw1NPHFo1cAcdY/xktxaAt djRY7N09QCLctuhiRwkJNbD8hn+5tlP70t3q7pw8ShPYc2CUHq5ul2zchDyldWD5XzBJ +x3BYfjMNBKQx6REzuFXkTXJ79xO9P7jW0PMSpICj1r1QoxDamjJZ6C9/A5iyu/VnwUf 04CNDNhw02JppyAR/BtnI9iG2KgR+9BTVJPVHjQ8dB167DTTlu0RJfot77vAxSMjcdda DrvoyoQn99g34zPHsOiMt+gC1KIjie/wwn2tYXYsyLGFGkSQ1xXCaLNBzmbcsjeKJuDa /oPg== 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=kHreVrWBtfEabawQXtYP38zCXVcu+wKc5i9U/t1ocA4=; b=Drtpa4muVVVFpCrdwPhquKCCe/8RAb+idWA6EGB4Dad/KZvH1canINRS+VHBSNF+xc Aj8b7U/sOhUyUl53bs9rVxtuPSv1GF/8vSOV16OYCkw3vVXIryoTVqQf5cgzOdMnBSmA 3Pv6u968kKwrxcJJei2OZW2flIYzthRw6CCCZyuMlRlb9iAtIJdQJxJ6GPu4l1E0HaBA 0LfPfWZrglA/BgTHukzhpFbA7ZfT6dC4Dh/a3XD6SQUcaNU0uQA3dUTD3ltLJowRb2Ro pCgfZYtnYqZVYYaAY8HkjU9Tg5oHF07YuWUCYfUJKKiMWWGnwg8hg5JINCfesVAp/W4q Dvqw== 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 cg6si17116203plb.350.2019.06.19.08.18.35; Wed, 19 Jun 2019 08:18:50 -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 S1729179AbfFSPST (ORCPT + 99 others); Wed, 19 Jun 2019 11:18:19 -0400 Received: from foss.arm.com ([217.140.110.172]:44722 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726958AbfFSPST (ORCPT ); Wed, 19 Jun 2019 11:18:19 -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 75D91344; Wed, 19 Jun 2019 08:18:18 -0700 (PDT) Received: from [0.0.0.0] (e107985-lin.cambridge.arm.com [10.1.194.38]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id BE8683F246; Wed, 19 Jun 2019 08:18:16 -0700 (PDT) Subject: Re: [PATCH 1/8] sched: introduce task_se_h_load helper To: Rik van Riel , peterz@infradead.org Cc: mingo@redhat.com, linux-kernel@vger.kernel.org, kernel-team@fb.com, morten.rasmussen@arm.com, tglx@linutronix.de, dietmar.eggeman@arm.com, mgorman@techsingularity.com, vincent.guittot@linaro.org References: <20190612193227.993-1-riel@surriel.com> <20190612193227.993-2-riel@surriel.com> <55d914d2-fba2-48c0-e7ff-3c7337c8cf8e@arm.com> From: Dietmar Eggemann Message-ID: <9e75dd03-23e5-8ab3-8f5c-789b2581b3a7@arm.com> Date: Wed, 19 Jun 2019 17:18:15 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 6/19/19 3:57 PM, Rik van Riel wrote: > On Wed, 2019-06-19 at 14:52 +0200, Dietmar Eggemann wrote: > >>> @@ -7833,14 +7834,19 @@ static void update_cfs_rq_h_load(struct >>> cfs_rq *cfs_rq) >>> } >>> } >>> >>> -static unsigned long task_h_load(struct task_struct *p) >>> +static unsigned long task_se_h_load(struct sched_entity *se) >>> { >>> - struct cfs_rq *cfs_rq = task_cfs_rq(p); >>> + struct cfs_rq *cfs_rq = cfs_rq_of(se); >>> >>> update_cfs_rq_h_load(cfs_rq); >>> - return div64_ul(p->se.avg.load_avg * cfs_rq->h_load, >>> + return div64_ul(se->avg.load_avg * cfs_rq->h_load, >>> cfs_rq_load_avg(cfs_rq) + 1); >>> } >> >> I wonder if this is necessary. I placed a BUG_ON(!entity_is_task(se)) >> into task_se_h_load() after I applied the whole patch-set and ran >> some >> taskgroup related testcases. It didn't hit. >> >> So why not use task_h_load(task_of(se)) instead? >> >> [...] > > That would work, but task_h_load then dereferences > task->se to get the se->avg.load_avg value. > > Going back to task from the se, only to then get the > se from the task seems a little unnecessary :) > > Can you explain why you think task_h_load(task_of(se)) > would be better? I think I may be overlooking something. Ah, OK, I just wanted to avoid having task_se_h_load() and task_h_load() at the same time. You could replace the remaining calls to task_h_load(p) with task_se_h_load(&p->se) in this case. - task_load = task_h_load(p); + task_load = task_se_h_load(&p->se); Not that important though right now ...