Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2330443imm; Fri, 7 Sep 2018 14:47:49 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYCmvvHzBr+XpsvFuqP3WA93wyL0DQTQKpp7n8jOg22tUvjkYYoHyTDnCOxvvuz6NNlk9FY X-Received: by 2002:a65:5a81:: with SMTP id c1-v6mr10411028pgt.120.1536356869024; Fri, 07 Sep 2018 14:47:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356868; cv=none; d=google.com; s=arc-20160816; b=J9I/MKI0a/BSN5c7bpl2laRbZ4300FdscfDUNSq1RzVymm94KHHa+eBtIDnp9rMeGh Pa/6Yg6CW2vlz7EOHn8x9vtddDf5uv0px0nZvXC5/sRIvBe6rUfNWn3FMC8NIzgwbIVv z7J4cjRfh2aH3a9RxdqNVgQDD/7chKyhjYXoQSrEWteFEvI6I6TL60FXr3qs8H6wCa/u HSY2jCK/iSiZM4Wp6cL7y0eRCcgSi4CjoZfBUuPZPavoz6QZBHn39CdJPK81X4XNrVsb OTzIcyOJLW0rErAkREqQthNVjFDCxLlBjdB8MY+kOyeBkyjuXfAKQ2tgcvJfcdYzn4hv lqEw== 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=Q4VlKEIzQ9ghjlQStoWzZ/biYxOTK2TcK4e+GD5ynd0=; b=xTpLwQdU3/yaxaV4FnV+eDf/pRbEfE1mGv7r71miAwgxpihZQkSjhpMAMM91QX/Lx8 7xCIWY50eJT7INMNzJZiaplUoS0nBtbcUQ75MN3SuPmqWDNRNMNiTjcQM0uwEVVsZB2e CwwxDCCHQb6tc7cvo1NjSVC6+WaUOrqIJpGX1naLS04xkpenRiOCIIRvKRL5WiqRQ+6w hdKgxGdu250prRqWdjisooGxIrqCRymIDkYZy4gz3bxBGvDVnTTz9BRBVbAbjKYY1IjW uuvCt5/SonK3w7jzZkNg9WPRmWtz0PAv1xGsQIeMABbhL8yVjBVod0oyluiYX6AYXxWX 2DEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=b16If6Kt; 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 a93-v6si9294053pla.277.2018.09.07.14.47.34; Fri, 07 Sep 2018 14:47:48 -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=b16If6Kt; 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 S1731058AbeIHC2F (ORCPT + 99 others); Fri, 7 Sep 2018 22:28:05 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:29622 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729956AbeIHC2E (ORCPT ); Fri, 7 Sep 2018 22:28:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536356708; x=1567892708; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Q4VlKEIzQ9ghjlQStoWzZ/biYxOTK2TcK4e+GD5ynd0=; b=b16If6KtKQNzb7hZ84s15j9yitGkDBCqz/C4zGbCOpnVzTN3K1OBM30o VWnCbefq40rQP4m7oT0Sr+rDWhxOIbwpVXLyE6a1MlkjC0F4RupxkZjQ2 TTovJGAkcBdbacwaHeTDGkLjKWCaSacovHIiCI31/XqVoVZ3GZphjwf3/ U=; X-IronPort-AV: E=Sophos;i="5.53,343,1531785600"; d="scan'208";a="752286674" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-1e-17c49630.us-east-1.amazon.com) ([10.47.22.34]) by smtp-border-fw-out-33001.sea14.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Sep 2018 21:42:34 +0000 Received: from u7588a65da6b65f.ant.amazon.com (iad7-ws-svc-lb50-vlan3.amazon.com [10.0.93.214]) by email-inbound-relay-1e-17c49630.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w87LfNmS019688 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2018 21:41:25 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 w87LfLKK027160 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Sep 2018 23:41:21 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w87LfKwv027159; Fri, 7 Sep 2018 23:41:20 +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 07/60] sched: Reduce dependencies of init_tg_cfs_entry() Date: Fri, 7 Sep 2018 23:39:54 +0200 Message-Id: <20180907214047.26914-8-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 Decouple init_tg_cfs_entry() from other structures' implementation details, so that it only updates/accesses task group related fields of the CFS runqueue and its SE. This prepares calling this function in slightly different contexts. Signed-off-by: Jan H. Schönherr --- kernel/sched/core.c | 3 ++- kernel/sched/fair.c | 13 +++++-------- kernel/sched/sched.h | 4 ++-- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index c38a54f57e90..48e37c3baed1 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -6019,7 +6019,8 @@ void __init sched_init(void) * directly in rq->cfs (i.e root_task_group->se[] = NULL). */ init_cfs_bandwidth(&root_task_group.cfs_bandwidth); - init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, i, NULL); + root_task_group.cfs_rq[i] = &rq->cfs; + init_tg_cfs_entry(&root_task_group, &rq->cfs, NULL, rq, NULL); #endif /* CONFIG_FAIR_GROUP_SCHED */ rq->rt.rt_runtime = def_rt_bandwidth.rt_runtime; diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 3de0158729a6..c0dd5825556c 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -9843,8 +9843,9 @@ int alloc_fair_sched_group(struct task_group *tg, struct task_group *parent) if (!se) goto err_free_rq; + tg->cfs_rq[i] = cfs_rq; init_cfs_rq(cfs_rq); - init_tg_cfs_entry(tg, cfs_rq, se, i, parent->cfs_rq[i]); + init_tg_cfs_entry(tg, cfs_rq, se, cpu_rq(i), parent->cfs_rq[i]); init_entity_runnable_average(se); } @@ -9900,17 +9901,13 @@ void unregister_fair_sched_group(struct task_group *tg) } void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, - struct sched_entity *se, int cpu, - struct cfs_rq *parent) + struct sched_entity *se, struct rq *rq, + struct cfs_rq *parent) { - struct rq *rq = cpu_rq(cpu); - cfs_rq->tg = tg; cfs_rq->rq = rq; - init_cfs_rq_runtime(cfs_rq); - - tg->cfs_rq[cpu] = cfs_rq; cfs_rq->my_se = se; + init_cfs_rq_runtime(cfs_rq); /* se could be NULL for root_task_group */ if (!se) diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 926a26d816a2..b8c8dfd0e88d 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -427,8 +427,8 @@ extern int alloc_fair_sched_group(struct task_group *tg, struct task_group *pare extern void online_fair_sched_group(struct task_group *tg); extern void unregister_fair_sched_group(struct task_group *tg); extern void init_tg_cfs_entry(struct task_group *tg, struct cfs_rq *cfs_rq, - struct sched_entity *se, int cpu, - struct cfs_rq *parent); + struct sched_entity *se, struct rq *rq, + struct cfs_rq *parent); extern void init_cfs_bandwidth(struct cfs_bandwidth *cfs_b); extern void __refill_cfs_bandwidth_runtime(struct cfs_bandwidth *cfs_b); -- 2.9.3.1.gcba166c.dirty