Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2331965imm; Fri, 7 Sep 2018 14:49:41 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaJYYV0MxA7hsd0vETnfLhfL1Ydn3m3+R+pOn8mZbWrUxuJr4rq5kN2AvwjbNt8/j70jLnl X-Received: by 2002:a17:902:4381:: with SMTP id j1-v6mr9771310pld.227.1536356981684; Fri, 07 Sep 2018 14:49:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356981; cv=none; d=google.com; s=arc-20160816; b=Hn29B7lRDvkoCWyPzroJpO1W9z/H6SOZMmPgBAavyaTDzeLfcOQ4UB+LgphAHXivsi 3fhjz2vaecM2lZOQWWb+hyaSdH8yTXExD3KlWB75PwYW6+Vns9hEToF4qvRYE8Ql386b dRXXbT1A/23k08uZBuerxx3F6Kvx8z41tON+8dZtS3NV+slKI5ECY5q5fgzxAy6IbwFd 57ELQwJ8+avicec+j38bNgRcC3bLpasU2y2ZdtyLjKtf+KLV2M8EE20cjj3eEKUukb0T orY0d1Fu0FoHT1Knb9qnk8ueUeSbKbucR8p4/hZ4TzJFrYes3w5oSdOAa4BExi2PpzSH cbpw== 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=qTeHYQR7DGn6ghhStncnoCma2/XhRiJT7+kV5ocIjUM=; b=qY+02WDz2Y3wjHf33a7UOqcr9z4I5POZCNICsj8s7Sdi+TkQenWg5IMfe+nQE4ru3F Pew3MNAUjf5WvZSPjzZm4NKsM3tX/bzGhZkgszRaQe4bR2ZLsXbTWdIgLLTCsWAKQCJz FEPL9SMwZ64as3yu0w7sa1i1Ch22BzbSGxZklSsESQldB0BIjn5z5L9LtHfrF+3Nrqm0 UcEmOCAGjVn1DyRHRt9a9PqaGBM5osn89r0sja3wllK/f0mA5xdF4JeOlKGbaV9t3iHJ GfOhcjhSVVnw4yX45gI8dMyEDxxD5p6c5qi92+jah+cX1QN6wTBsgrvHd0dgMmuW1ov/ Lp/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=VZbTXyQY; 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 e7-v6si9316024pgc.233.2018.09.07.14.49.26; Fri, 07 Sep 2018 14:49:41 -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=VZbTXyQY; 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 S1731272AbeIHC3v (ORCPT + 99 others); Fri, 7 Sep 2018 22:29:51 -0400 Received: from smtp-fw-33001.amazon.com ([207.171.190.10]:22745 "EHLO smtp-fw-33001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730672AbeIHC3u (ORCPT ); Fri, 7 Sep 2018 22:29:50 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536356813; x=1567892813; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qTeHYQR7DGn6ghhStncnoCma2/XhRiJT7+kV5ocIjUM=; b=VZbTXyQYEHkmScQixIzDmovsB4M6VMLMqlxl+d+TU5RWIEdro9iA9Pgb TsA5gyiW320NaVfZ9Qg7cFNOFLx1Vx55Fh4yHWMMwKYmwQDOJG04D1LW5 5oyzhMBunmeHF1uEi6M40EQWamnVCOOHBxSJgFcgeVBFhcfSHSwRIdKjq Y=; X-IronPort-AV: E=Sophos;i="5.53,343,1531785600"; d="scan'208";a="752286829" Received: from sea3-co-svc-lb6-vlan2.sea.amazon.com (HELO email-inbound-relay-2a-1c1b5cdd.us-west-2.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:44:24 +0000 Received: from u7588a65da6b65f.ant.amazon.com (pdx2-ws-svc-lb17-vlan3.amazon.com [10.247.140.70]) by email-inbound-relay-2a-1c1b5cdd.us-west-2.amazon.com (8.14.7/8.14.7) with ESMTP id w87LgiUg061268 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2018 21:42:46 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 w87LggiV027708 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Sep 2018 23:42:43 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w87LgfSZ027707; Fri, 7 Sep 2018 23:42:41 +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 46/60] cosched: Warn on throttling attempts of non-CPU runqueues Date: Fri, 7 Sep 2018 23:40:33 +0200 Message-Id: <20180907214047.26914-47-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 Initially, coscheduling won't support throttling of CFS runqueues that are not at CPU level. Print a warning to remind us of this fact and note down everything that's currently known to be broken, if we wanted to throttle higher level CFS runqueues (which would totally make sense from a coscheduling perspective). Signed-off-by: Jan H. Schönherr --- kernel/sched/fair.c | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0bba924b40ba..2aa3a60dfca5 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -4493,12 +4493,25 @@ static int tg_throttle_down(struct task_group *tg, void *data) static void throttle_cfs_rq(struct cfs_rq *cfs_rq) { - struct rq *rq = rq_of(cfs_rq); + struct rq *rq = hrq_of(cfs_rq); struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; long task_delta, dequeue = 1; bool empty; + /* + * FIXME: We can only handle CPU runqueues at the moment. + * + * rq->nr_running adjustments are incorrect for higher levels, + * as well as tg_throttle_down/up() functionality. Also + * update_runtime_enabled(), unthrottle_offline_cfs_rqs() + * have not been adjusted (used for CPU hotplugging). + * + * Ideally, we would apply throttling only to is_root runqueues, + * instead of the bottom level. + */ + SCHED_WARN_ON(!is_cpu_rq(rq)); + se = cfs_rq->my_se; /* freeze hierarchy runnable averages while throttled */ @@ -4547,12 +4560,14 @@ static void throttle_cfs_rq(struct cfs_rq *cfs_rq) void unthrottle_cfs_rq(struct cfs_rq *cfs_rq) { - struct rq *rq = rq_of(cfs_rq); + struct rq *rq = hrq_of(cfs_rq); struct cfs_bandwidth *cfs_b = tg_cfs_bandwidth(cfs_rq->tg); struct sched_entity *se; int enqueue = 1; long task_delta; + SCHED_WARN_ON(!is_cpu_rq(rq)); + se = cfs_rq->my_se; cfs_rq->throttled = 0; @@ -5171,6 +5186,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int flags) throttled = enqueue_entity_fair(rq, &p->se, flags, 1); + /* FIXME: assumes, that only bottom level runqueues get throttled */ if (!throttled) add_nr_running(rq, 1); @@ -5237,6 +5253,7 @@ static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int flags) { bool throttled = dequeue_entity_fair(rq, &p->se, flags, 1); + /* FIXME: assumes, that only bottom level runqueues get throttled */ if (!throttled) sub_nr_running(rq, 1); -- 2.9.3.1.gcba166c.dirty