Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2515548ybi; Mon, 1 Jul 2019 13:21:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy1/1qa//nvN+l6ZSaCz1qzc3RegIZRjJEJ/pTb+wg3ki+1ZA6Bu2QqOuqaYXdkUPSXZFF0 X-Received: by 2002:a17:90a:f98a:: with SMTP id cq10mr1217201pjb.43.1562012476235; Mon, 01 Jul 2019 13:21:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562012476; cv=none; d=google.com; s=arc-20160816; b=GoPMQh76+JgWD78YcIEnULBaWm8vZC66Lz9pM5ItEXkUz54K7hG7GQv8MR5So949lh WmP1nONHuDZzslyNPRM+ifmmX4Hla9S0KCzDSKQ7tx4q6zNDi3QewBZ5wp8qrvYXVaIA d4qHaG48q8s5Kb0s/a/CP931WPzU7if36re0mHxAQjE/dNo5s7ekMb70on6q4Rdmcty9 FIFv9G9Lta+VwgwwOfgQlJC9lBL/aXWreHiVmZCYKn+XDKn+FxM/YxouscnXj11tVaXK uRpdggC80ameuyeDciCPXk3CdTnUJguuoY92CwdwgGNI26gI+FQMMt9+G6bUdZYF7uoG 3+Bg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=YKLYJBfF6Xs5Sh+AvFb0x5KesF+JTuG7hjQLTrg/0HY=; b=YKF4aFZp1j4J5RgbZdmob5cXeKsGEbCiphIbkgW57pgVweM5cYIMezRXdxyd10ihr/ +h/gMeJMDIodEAWt45hhSa/T/xAe8yMzDK4zId1UeWYeW83pYZZFf4bRwCUFmE9zQG4i 5JNgUnkBoGKDmbFxC6kajLFdllgoROBAjVAZybgXTREgOafja+SRVJ1YkPB96d0XOGUY ejlOIU9pdpwe9g4fmnySOcdm6Qs+inW2/iG4D9FQXCllsTAD17aeTzpzaxuyU/aoaoXT klnaMtBHuYpSUTXGjrKw1OdPNw8JaVtYX3KGDRgGyZReKFFZgbK/0ZrevaVD4IXZiraF wc7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=SD517PuL; 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 m68si12381387pfb.75.2019.07.01.13.21.01; Mon, 01 Jul 2019 13:21:16 -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; dkim=pass header.i=@toxicpanda-com.20150623.gappssmtp.com header.s=20150623 header.b=SD517PuL; 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 S1726951AbfGAUUf (ORCPT + 99 others); Mon, 1 Jul 2019 16:20:35 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:40084 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726586AbfGAUUe (ORCPT ); Mon, 1 Jul 2019 16:20:34 -0400 Received: by mail-qk1-f195.google.com with SMTP id c70so12118486qkg.7 for ; Mon, 01 Jul 2019 13:20:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=toxicpanda-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=YKLYJBfF6Xs5Sh+AvFb0x5KesF+JTuG7hjQLTrg/0HY=; b=SD517PuLqxobQLE0ZbMWG5IoIobVDCZ2h3h+XUg1HIpw5WU2V5W9QopgycQKmlozw7 00GsN4R9+YTUhLnx+uJzfyearxwrrTquPPXatszUiQt5AsvGdahgofKneA/GUJtpx04X 1HATzCC9LrdrBzB+IZwGxB7tE50oq+3knc2FIAZvofNQjpoyZhWplSNiOINZopacfyIj AV2ExY61XLGo5K1K0ywn3DOSuxt0Ny60AIGT8fdSEX7eYv+i8/egIwLkuHjvLIdxBm8O Po6VMQhrJV38ZcA6G62g5uktJgZ1aspOD+541i74l9E28UWo3fJrQxkjosBhbUG7jqEY D9qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=YKLYJBfF6Xs5Sh+AvFb0x5KesF+JTuG7hjQLTrg/0HY=; b=Zq8N4QQTejJUZgzxP+e0wniKBcKBnPwY3qumQvB1keNNtNzLPDn/wqZ4whNKsy3Wlv 70I2UarqoTurZ9nOJ0VG460ScVjH+44dAFSGJVW7sKyfS+6ncJpaMLOToGA6uVqf+Mp4 YSTnWEoZJLpQO+D4p8WKFzeczKHcVnTFgYpB0B0Y5Up+jLpecCt8QRyrES0xxLrkCVFo K0G0a4hUHz6Ui+eMUcvAIgOdDcWmmAnM0M+fwdxAM6K9pfVUhVNTj0Uo9MXEzas8xZU3 aHEpqMO0ekDMB8RhhS0t5iqaZwNq/0N1oFWvXyJtRfeUp+voXtzbAH+9N/s3tEjmTAUZ ejfg== X-Gm-Message-State: APjAAAUk3tqCBkUvYozrHSf6UXyNE6016CIXaiyUS+Ne0+pS+/BfJ14O e4or3keKz2k7WSkzQhN0F583FQ== X-Received: by 2002:a37:c408:: with SMTP id d8mr22103639qki.18.1562012433559; Mon, 01 Jul 2019 13:20:33 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::2ce6]) by smtp.gmail.com with ESMTPSA id o54sm6242083qtb.63.2019.07.01.13.20.32 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 01 Jul 2019 13:20:32 -0700 (PDT) Date: Mon, 1 Jul 2019 16:20:31 -0400 From: Josef Bacik To: Rik van Riel Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com, pjt@google.com, dietmar.eggemann@arm.com, peterz@infradead.org, mingo@redhat.com, morten.rasmussen@arm.com, tglx@linutronix.de, mgorman@techsingularity.net, vincent.guittot@linaro.org Subject: Re: [PATCH 09/10] sched,fair: add helper functions for flattened runqueue Message-ID: <20190701202030.6sm7mdztyt6t5mui@macbook-pro-91.dhcp.thefacebook.com> References: <20190628204913.10287-1-riel@surriel.com> <20190628204913.10287-10-riel@surriel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190628204913.10287-10-riel@surriel.com> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jun 28, 2019 at 04:49:12PM -0400, Rik van Riel wrote: > Add helper functions to make the flattened runqueue patch a little smaller. > > The task_se_h_weight function is similar to task_se_h_load, but scales the > task weight by the group weight, without taking the task's duty cycle into > account. > > The task_se_in_cgroup helper is functionally identical to parent_entity, > but directly calling a function with that name obscures what the other > code is trying to use it for, and would make the code harder to understand. > > Signed-off-by: Rik van Riel > --- > kernel/sched/fair.c | 26 ++++++++++++++++++++++++++ > 1 file changed, 26 insertions(+) > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > index a751e7a9b228..6fea8849cc12 100644 > --- a/kernel/sched/fair.c > +++ b/kernel/sched/fair.c > @@ -243,6 +243,7 @@ static u64 __calc_delta(u64 delta_exec, unsigned long weight, struct load_weight > > const struct sched_class fair_sched_class; > static unsigned long task_se_h_load(struct sched_entity *se); > +static unsigned long task_se_h_weight(struct sched_entity *se); > > /************************************************************** > * CFS operations on generic schedulable entities: > @@ -411,6 +412,12 @@ static inline struct sched_entity *parent_entity(struct sched_entity *se) > return se->parent; > } > > +/* Is this (task) sched_entity in a non-root cgroup? */ > +static inline bool task_se_in_cgroup(struct sched_entity *se) > +{ > + return parent_entity(se); > +} > + > static void > find_matching_se(struct sched_entity **se, struct sched_entity **pse) > { > @@ -7819,6 +7826,20 @@ static void update_cfs_rq_h_load(struct cfs_rq *cfs_rq) > } > } > > +static unsigned long task_se_h_weight(struct sched_entity *se) > +{ > + struct cfs_rq *cfs_rq; > + > + if (!task_se_in_cgroup(se)) > + return se->load.weight; > + > + cfs_rq = group_cfs_rq_of_parent(se); > + update_cfs_rq_h_load(cfs_rq); > + > + /* Reduce the load.weight by the h_load of the group the task is in. */ > + return (cfs_rq->h_load * se->load.weight) >> SCHED_FIXEDPOINT_SHIFT; This should be scale_load_down(cfs_rq->h_load * se->load.weight); Thanks, Josef