Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2331352imm; Fri, 7 Sep 2018 14:48:57 -0700 (PDT) X-Google-Smtp-Source: ANB0VdbLuPok/UYXqnYO1xgVoNYKI9886VZxXZrITpdfozqLnXRZhzWTDwVsO0qBB7hk/w+qyMso X-Received: by 2002:a17:902:b7c5:: with SMTP id v5-v6mr10267418plz.49.1536356937363; Fri, 07 Sep 2018 14:48:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356937; cv=none; d=google.com; s=arc-20160816; b=wzPSIvyUI+HCF501EUV7ECK9izw7WebO+R1ltRIYV4QannDsekn5/fyOinHNGMEvUU WAh/XKTSmXEeOje7f+mu1qdxoPB7NdyRudIaioJ5zdu8/Sy7ShDbZBCwoktmd/xGxH9M nHWWKeGgpuXOD0N8NvpQWqeu/f+OZJoZLAevtGt69HAn8NTiw0W9BAPLgE6Z35UWTalB LzCdpt5MLsCFD7NlOEBcnQFgiDak2LDvfRsHSJOn/RfuYhHZaAJgjN3pCZv7GLDMc71Z WESW9iZZnBI6b6HQtAxbBHXWT8Pl8U6R70Xz5Saue1em8rEvhyCYHCTKE4cWqi1KaKzg bXIA== 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:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=iPBbmqmep3+XtgUFEEskUtxQgZvwKaFpny2qtCURQcE=; b=CnXpLnDttgzhSQyQPOOgP9OEasp8CO0u9jxQaCjeU+fJGOVD+IFuGx20iUcw18qPo0 Y69KqQDI8nlrLUmW4LTRGuksftmyhBBPA0gkfLBCYOQ8ghhrIUZW0GWN7tZv2wqEMu2J BonUGaf1HfgI4mejOHO53PPb3dEwJnbk0wu7zZ44IiFRsQ1U4QGMjgIF5EBRo+0SFoJr dUy4g+vqEo5N5BeQwDUMllsLtR0PLoUja8G2/ZmUHC5oRUp7FLMyHpBUIZmS/IaKF/+w DgdwrBRlVyf1hPXYbfwF93B5kjYW+2lyetpoHdbuYtxo6kGpYBIUz3CbyfprQT7D6C6R d5Tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=PS99KC1q; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id w20-v6si9792704pgf.434.2018.09.07.14.48.42; Fri, 07 Sep 2018 14:48: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; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=PS99KC1q; 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; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731259AbeIHC3Y (ORCPT + 99 others); Fri, 7 Sep 2018 22:29:24 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:31852 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730347AbeIHC3T (ORCPT ); Fri, 7 Sep 2018 22:29:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536356783; x=1567892783; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iPBbmqmep3+XtgUFEEskUtxQgZvwKaFpny2qtCURQcE=; b=PS99KC1q/ElTGHZj7zf90vwjbjsLLFajDyuzM28iBc5hWUbAGAuBiUyu rxhuIfs5TSXi0KSuMT+B9S4Z1qolzCxbdqgoeJ6kMdCEdJtOptnXe+9Ke 8wsIQQddOez9gHjS2Ha9jnvgqPZHYvPIuEzemOnQp5WOCdADDDEiyF46s Q=; X-IronPort-AV: E=Sophos;i="5.53,343,1531785600"; d="scan'208";a="757370704" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-2a-7c3c5f85.us-west-2.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Sep 2018 21:43:48 +0000 Received: from u7588a65da6b65f.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2a-7c3c5f85.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w87LgBNp035985 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2018 21:42:13 GMT Received: from u7588a65da6b65f.ant.amazon.com (localhost [127.0.0.1]) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Debian-3) with ESMTPS id w87LgA8k027458 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Sep 2018 23:42:10 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w87Lg9HB027457; Fri, 7 Sep 2018 23:42:09 +0200 From: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= To: Ingo Molnar , Peter Zijlstra Cc: =?UTF-8?q?Jan=20H=2E=20Sch=C3=B6nherr?= , linux-kernel@vger.kernel.org Subject: [RFC 28/60] cosched: Add is_sd_se() to distinguish SD-SEs from TG-SEs Date: Fri, 7 Sep 2018 23:40:15 +0200 Message-Id: <20180907214047.26914-29-jschoenh@amazon.de> X-Mailer: git-send-email 2.9.3.1.gcba166c.dirty In-Reply-To: <20180907214047.26914-1-jschoenh@amazon.de> References: <20180907214047.26914-1-jschoenh@amazon.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Add a function is_sd_se() to easily distinguish SD-SEs from a TG-SEs. Internally, we distinguish tasks, SD-SEs, and TG-SEs based on the my_q field. For tasks it is empty, for TG-SEs it is a pointer, and for SD-SEs it is a magic value. Also modify propagate_entity_load_avg() to not page fault on SD-SEs. Signed-off-by: Jan H. Schönherr --- kernel/sched/fair.c | 12 +++++------- kernel/sched/sched.h | 14 ++++++++++++++ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 18b1d81951f1..9cbdd027d449 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -279,6 +279,8 @@ static inline struct cfs_rq *cfs_rq_of(struct sched_entity *se) /* runqueue "owned" by this group */ static inline struct cfs_rq *group_cfs_rq(struct sched_entity *grp) { + if (grp->my_q == INDIRECT_GROUP) + return NULL; return grp->my_q; } @@ -3240,13 +3242,9 @@ static inline void add_tg_cfs_propagate(struct cfs_rq *cfs_rq, long runnable_sum /* Update task and its cfs_rq load average */ static inline int propagate_entity_load_avg(struct sched_entity *se) { - struct cfs_rq *cfs_rq, *gcfs_rq; - - if (entity_is_task(se)) - return 0; + struct cfs_rq *cfs_rq, *gcfs_rq = group_cfs_rq(se); - gcfs_rq = group_cfs_rq(se); - if (!gcfs_rq->propagate) + if (!gcfs_rq || !gcfs_rq->propagate) return 0; gcfs_rq->propagate = 0; @@ -9931,7 +9929,7 @@ void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, /* se is NULL for root_task_group */ if (se) { set_entity_cfs(se, parent); - se->my_q = cfs_rq; + se->my_q = cfs_rq ?: INDIRECT_GROUP; /* guarantee group entities always have weight */ update_load_set(&se->load, NICE_0_LOAD); diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 456b266b8a2c..5e2d231b1dbf 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1146,6 +1146,13 @@ static inline struct rq *parent_rq(struct rq *rq) return NULL; return container_of(rq->sdrq_data.parent, struct rq, sdrq_data); } + +#define INDIRECT_GROUP ERR_PTR(-EREMOTE) + +static inline bool is_sd_se(struct sched_entity *se) +{ + return se->my_q == INDIRECT_GROUP; +} #else /* !CONFIG_COSCHEDULING */ static inline int node_of(struct rq *rq) { @@ -1161,6 +1168,13 @@ static inline struct rq *parent_rq(struct rq *rq) { return NULL; } + +#define INDIRECT_GROUP NULL + +static inline bool is_sd_se(struct sched_entity *se) +{ + return false; +} #endif /* !CONFIG_COSCHEDULING */ #ifdef CONFIG_COSCHEDULING -- 2.9.3.1.gcba166c.dirty