Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2326918imm; Fri, 7 Sep 2018 14:43:45 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaWomkm7MGnzXIXM0lngWO69fGB4yZZ4poNqbxFBkH9cYHvX3YgAaPluJm/toft+DvsHAVc X-Received: by 2002:a17:902:8a90:: with SMTP id p16-v6mr10172473plo.106.1536356625360; Fri, 07 Sep 2018 14:43:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536356625; cv=none; d=google.com; s=arc-20160816; b=Qwoc7dgdkJksschmK7HW/Kc50hL+XHn3UK7terMijcwO23M6Sfx1srpfDlkFvZEXmy JR+O9fIl2D/BgwWs2k0hx44v8x9OBGxPbR9yolXp7BzcFfDBdt6MyQQNPGKAZ4/YGqoB 8pGBaq/Gthv98wBVADtg5x8SpqVZ9KbKp9wZ416tFavzfoVeGUQf+xuEoT1CA1Cl2xdc WMECw7kcvSqi4OJdoPxdGd1F8dbrNC2RENDwTvISq5IrBjR3FJAzcmqtU8vahXv7N0z9 Vu+uN27+97pxkwekS0TFhsVI3xqoL5X0OSX7uMbBj6f1PBZlK3ius13gx7UlI3rUIzTm sz0w== 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=cFEIvKdv9arNngd5zBLVX3sFtX1JtMNhcR2VDzzqRGs=; b=bQYbM+aP/kPFZXuLFWK0h3ZAPQpaFoR1rq4cosm6+VWXorl2D888N43pqO3Pu7PwtE cyLuyk8EVzRmEXmlqCQpygp9qNpVI3u0k2OcZysWv/Am+II4r7FDn9leV7AlaU5ra2XA Jpe2U2Zt6/uksPaAvQ1G073WdqPqiDmTIN3qLJayhl8vpU1zdtdGNP7Y7IqSTmsVclVR +TTYR9mvkz3kV9BaKcmoxlJ3LtfxgIiyubkHwgVvI/JgeidwCe61pcq4kdyWmjZ8ucfI 2PSvirKMB1zuDUu5smVvi3HOBWWZiQ4D2bHDBk3gM100xqn2Q/qxfleB0BuBlNnV3K6T j+Mw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.de header.s=amazon201209 header.b=Wcu4v8bm; 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.43.30; Fri, 07 Sep 2018 14:43:45 -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=Wcu4v8bm; 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 S1730457AbeIHCZA (ORCPT + 99 others); Fri, 7 Sep 2018 22:25:00 -0400 Received: from smtp-fw-2101.amazon.com ([72.21.196.25]:28575 "EHLO smtp-fw-2101.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730004AbeIHCY7 (ORCPT ); Fri, 7 Sep 2018 22:24:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.de; i=@amazon.de; q=dns/txt; s=amazon201209; t=1536356524; x=1567892524; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=cFEIvKdv9arNngd5zBLVX3sFtX1JtMNhcR2VDzzqRGs=; b=Wcu4v8bmLsVhSMdQxRUwiBdg84AuvPG2W3tYf5aKIr+PoNAuyvnBwQDW w4wNzKxap6TBxzw6d6jhePL4GgPAVItE1NRapIcUX7qD0qewGwz6zs5Ia IQ233+F9mdNL/ei4twY7vcbyHU4GkWsMh3D94Y8RO1pa+Ty7DQVmKNoDo 0=; X-IronPort-AV: E=Sophos;i="5.53,343,1531785600"; d="scan'208";a="696509913" Received: from iad6-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-7c3c5f85.us-west-2.amazon.com) ([10.124.125.2]) by smtp-border-fw-out-2101.iad2.amazon.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 07 Sep 2018 21:42:03 +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 w87Lfxn9035640 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 7 Sep 2018 21:42:00 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 w87LfvE4027352 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 7 Sep 2018 23:41:57 +0200 Received: (from jschoenh@localhost) by u7588a65da6b65f.ant.amazon.com (8.15.2/8.15.2/Submit) id w87LfpKE027335; Fri, 7 Sep 2018 23:41:51 +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 21/60] sched: Add entity variants of put_prev_task_fair() and set_curr_task_fair() Date: Fri, 7 Sep 2018 23:40:08 +0200 Message-Id: <20180907214047.26914-22-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 entity variants of put_prev_task_fair() and set_curr_task_fair() that will be later used by coscheduling. Signed-off-by: Jan H. Schönherr --- kernel/sched/fair.c | 34 +++++++++++++++++++++------------- kernel/sched/sched.h | 2 ++ 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index f13fb4460b66..18b1d81951f1 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6651,12 +6651,8 @@ done: __maybe_unused; return NULL; } -/* - * Account for a descheduled task: - */ -static void put_prev_task_fair(struct rq *rq, struct task_struct *prev) +void put_prev_entity_fair(struct rq *rq, struct sched_entity *se) { - struct sched_entity *se = &prev->se; struct cfs_rq *cfs_rq; for_each_sched_entity(se) { @@ -6666,6 +6662,14 @@ static void put_prev_task_fair(struct rq *rq, struct task_struct *prev) } /* + * Account for a descheduled task: + */ +static void put_prev_task_fair(struct rq *rq, struct task_struct *prev) +{ + put_prev_entity_fair(rq, &prev->se); +} + +/* * sched_yield() is very simple * * The magic of dealing with the ->skip buddy is in pick_next_entity. @@ -9758,15 +9762,8 @@ static void switched_to_fair(struct rq *rq, struct task_struct *p) } } -/* Account for a task changing its policy or group. - * - * This routine is mostly called to set cfs_rq->curr field when a task - * migrates between groups/classes. - */ -static void set_curr_task_fair(struct rq *rq) +void set_curr_entity_fair(struct rq *rq, struct sched_entity *se) { - struct sched_entity *se = &rq->curr->se; - for_each_sched_entity(se) { struct cfs_rq *cfs_rq = cfs_rq_of(se); @@ -9776,6 +9773,17 @@ static void set_curr_task_fair(struct rq *rq) } } +/* + * Account for a task changing its policy or group. + * + * This routine is mostly called to set cfs_rq->curr field when a task + * migrates between groups/classes. + */ +static void set_curr_task_fair(struct rq *rq) +{ + set_curr_entity_fair(rq, &rq->curr->se); +} + void init_cfs_rq(struct cfs_rq *cfs_rq) { cfs_rq->tasks_timeline = RB_ROOT_CACHED; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 569a487ed07c..b36e61914a42 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -1547,6 +1547,8 @@ bool enqueue_entity_fair(struct rq *rq, struct sched_entity *se, int flags, unsigned int task_delta); bool dequeue_entity_fair(struct rq *rq, struct sched_entity *se, int flags, unsigned int task_delta); +void put_prev_entity_fair(struct rq *rq, struct sched_entity *se); +void set_curr_entity_fair(struct rq *rq, struct sched_entity *se); struct sched_class { const struct sched_class *next; -- 2.9.3.1.gcba166c.dirty