Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1091343imm; Thu, 13 Sep 2018 12:31:33 -0700 (PDT) X-Google-Smtp-Source: ANB0Vdaht5wIoWdU5mCRLsWVdzOpFIquqJbnK9atqNKhl7l3vkKsHw8qx27KpoYZGLfrZjSdfHuf X-Received: by 2002:a62:6003:: with SMTP id u3-v6mr8871216pfb.114.1536867093399; Thu, 13 Sep 2018 12:31:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536867093; cv=none; d=google.com; s=arc-20160816; b=YnxPGKVSeMoHXC1dmdN08oMNzpyZ8t570Ec9qqvuAqMOQikh0IH0W80FPLRJgvgYJK woRPg186wL94X65HVHYcMDhsH10fmPW3uor3A7b5umSVLXHgPag5hyxOya6SKI9N/nm0 Kq0X3KC2ZJoCpBMEdenIEjEhff4ikDdRhHoFkh9zMsesu6NW1V5vfS9rgcDv8HOH21z/ erOsWie/nGIdLQ/KCMtWFjgvn3XcYFo7i/XTzKP2/3PjLrs6yCjBflAsJRb2ZKjb+n6h 6tYBr2zFqlxBzk3MB6csQMs1xAEQHwpiEyUKvzKqQm3zdeClzhCLqo1ltwGji6MYewBj 1YiQ== 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=AiacIuApp0eSLutNfSR5HNoRyCYtqlklZLpC+GUFnu8=; b=k+xKb1yIai8fFs+fGDcf2uy6cOd4eK12rb6PFlFq5Ycg42sKZXPZQIThUmAVhlPYpk fu4ppjAl3sbPWL5zDqMUuKNu+BmAKfdSKh9vbsPcwBgEgjVWD5O+bL4tafwdNac5zyb3 jhK7H/tdY/S9ynNr3IoDO0GCOPPbO62nbMgXpMdD+xJ9OowQJkaE5asEOMFWKzwcET0U GO6HK6bKLXQZ2mL8rAnOvhzfKOZC2bH/NOYYrcqIyhtbVv5ghAtkoNvdXDCQgbf2oTGp kZXYN75Psc8N98TlaXeH9u9YUOmuFQeAUn1vHsOjDC/w0mQzFTVCve7RMY2t5IzvSPPE grEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=C0Rqg3DC; 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 u3-v6si4686890plb.401.2018.09.13.12.31.01; Thu, 13 Sep 2018 12:31:33 -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=C0Rqg3DC; 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 S1728154AbeINAb2 (ORCPT + 99 others); Thu, 13 Sep 2018 20:31:28 -0400 Received: from smtp-fw-9101.amazon.com ([207.171.184.25]:24318 "EHLO smtp-fw-9101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727730AbeINAb2 (ORCPT ); Thu, 13 Sep 2018 20:31:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536866435; x=1568402435; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=AiacIuApp0eSLutNfSR5HNoRyCYtqlklZLpC+GUFnu8=; b=C0Rqg3DChxADGMtkxvlVtColnUPFFeqv879b769Wtny21Fo2keH7ytWW HNtN4CDy0PepPHSpGEjn4cnlq9lnM0eNMAZZtU9VOkFybaBdTANo4B+t1 Yy+6EqvTD0ZYW7dgR+rGT9Cr7kjYo6K6Sc8cQZTSO9M9ApvJPzG/YJ+IQ 4=; X-IronPort-AV: E=Sophos;i="5.53,370,1531785600"; d="scan'208";a="758125105" Received: from sea3-co-svc-lb6-vlan3.sea.amazon.com (HELO email-inbound-relay-1a-807d4a99.us-east-1.amazon.com) ([10.47.22.38]) by smtp-border-fw-out-9101.sea19.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 13 Sep 2018 19:20:33 +0000 Received: from u7588a65da6b65f.ant.amazon.com (iad7-ws-svc-lb50-vlan2.amazon.com [10.0.93.210]) by email-inbound-relay-1a-807d4a99.us-east-1.amazon.com (8.14.7/8.14.7) with ESMTP id w8DJKPV7085014 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Thu, 13 Sep 2018 19:20:28 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 w8DJKM1j030743 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 13 Sep 2018 21:20:22 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w8DJKJqD030738; Thu, 13 Sep 2018 21:20:19 +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?= , Nishanth Aravamudan , linux-kernel@vger.kernel.org Subject: [RFC 61/60] cosched: Accumulated fixes and improvements Date: Thu, 13 Sep 2018 21:19:38 +0200 Message-Id: <20180913191938.30526-1-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 Here is an "extra" patch containing bug fixes and warning removals, that I have accumulated up to this point. It goes on top of the other 60 patches. (When it is time for v2, these fixes will be integrated into the appropriate patches within the series.) The changes are: 1. Avoid a hang with nested scheduled task groups. 2. Get rid of a lockdep warning. 3. Get rid of warnings about missed clock updates. 4. Get rid of "untested code path" warnings/reminders (after testing said code paths). This should make experimenting with this patch series a little less bumpy. Partly-reported-by: Nishanth Aravamudan Signed-off-by: Jan H. Schönherr --- kernel/sched/cosched.c | 2 ++ kernel/sched/fair.c | 35 ++++++++++------------------------- 2 files changed, 12 insertions(+), 25 deletions(-) diff --git a/kernel/sched/cosched.c b/kernel/sched/cosched.c index a1f0d3a7b02a..88b7bc6d4bfa 100644 --- a/kernel/sched/cosched.c +++ b/kernel/sched/cosched.c @@ -588,6 +588,7 @@ static void sdrq_update_root(struct sdrq *sdrq) /* Get proper locks */ rq_lock_irqsave(rq, &rf); + update_rq_clock(rq); sdrq->is_root = is_root; if (is_root) @@ -644,6 +645,7 @@ static void sdrq_update_root(struct sdrq *sdrq) } if (sdrq->cfs_rq->curr) { rq_lock(prq, &prf); + update_rq_clock(prq); if (sdrq->data->leader == sdrq->sd_parent->data->leader) put_prev_entity_fair(prq, sdrq->sd_parent->sd_se); rq_unlock(prq, &prf); diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 8da2033596ff..4c823fa367ad 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -7150,23 +7150,6 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf se = pick_next_entity(cfs_rq, curr); cfs_rq = pick_next_cfs(se); - -#ifdef CONFIG_COSCHEDULING - if (cfs_rq && is_sd_se(se) && cfs_rq->sdrq.is_root) { - WARN_ON_ONCE(1); /* Untested code path */ - /* - * Race with is_root update. - * - * We just moved downwards in the hierarchy via an - * SD-SE, the CFS-RQ should have is_root set to zero. - * However, a reconfiguration may be in progress. We - * basically ignore that reconfiguration. - * - * Contrary to the case below, there is nothing to fix - * as all the set_next_entity() calls are done later. - */ - } -#endif } while (cfs_rq); if (is_sd_se(se)) @@ -7189,23 +7172,26 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf while (!(cfs_rq = is_same_group(se, pse))) { int se_depth = se->depth; int pse_depth = pse->depth; + bool work = false; - if (se_depth <= pse_depth && leader_of(pse) == cpu) { + if (se_depth <= pse_depth && __leader_of(pse) == cpu) { put_prev_entity(cfs_rq_of(pse), pse); pse = parent_entity(pse); + work = true; } - if (se_depth >= pse_depth && leader_of(se) == cpu) { + if (se_depth >= pse_depth && __leader_of(se) == cpu) { set_next_entity(cfs_rq_of(se), se); se = parent_entity(se); + work = true; } - if (leader_of(pse) != cpu && leader_of(se) != cpu) + if (!work) break; } - if (leader_of(pse) == cpu) - put_prev_entity(cfs_rq, pse); - if (leader_of(se) == cpu) - set_next_entity(cfs_rq, se); + if (__leader_of(pse) == cpu) + put_prev_entity(cfs_rq_of(pse), pse); + if (__leader_of(se) == cpu) + set_next_entity(cfs_rq_of(se), se); } goto done; @@ -7243,7 +7229,6 @@ pick_next_task_fair(struct rq *rq, struct task_struct *prev, struct rq_flags *rf struct sched_entity *se2 = cfs_rq->sdrq.tg_se; bool top = false; - WARN_ON_ONCE(1); /* Untested code path */ while (se && se != se2) { if (!top) { put_prev_entity(cfs_rq_of(se), se); -- 2.9.3.1.gcba166c.dirty