From patchwork Wed Nov 15 09:04:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: tip-bot2 for Thomas Gleixner X-Patchwork-Id: 165208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2412190vqg; Wed, 15 Nov 2023 01:05:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHzLpWQ7+J4SU9vVh7LBAcu6GX8wPrKKH6FcOxZmSD2pY1K/JMaONOc5kHg+jO/cxtiNy29 X-Received: by 2002:a05:6808:219a:b0:3b2:dd7d:fc5e with SMTP id be26-20020a056808219a00b003b2dd7dfc5emr17353341oib.10.1700039128174; Wed, 15 Nov 2023 01:05:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700039128; cv=none; d=google.com; s=arc-20160816; b=sj/1F1wbv835ED97Fs52svx7j8/3SRbqev0fh5aXlFk/pc4WM8Jwp/sFiNXVR0Ojh6 TzuKtDQc/VwYfx2L9lCmMV3rcGhfz/7FVAGI3jG2q5WFgzfG4XZbO0uiEPolsUq5G+si pQJtYvMah3ru9tgjWG1SpJd/JoNWTeP2cY1llxAHc9Xy+4DqiFSBzahFu1GAN2n2dzRZ hlGOaSZuYsW84lCBWccWxoCPJDkp35ZmM3B/6gCTno8txn0rR0oF0CT1JNkwGdAvvH2d ElMDxi9pQvawNl5KE/b0czi5KrLoy/N9HHn7hw/5yDfGvmAPKuiq65ap50xe2s1pdVEo 6VpQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=FDYsmJeTGcPNQRpxou+VlALaTQpSQyDGIv5As9gc9js=; fh=FvIE/kf7nmpvKwX0p79VcCq6fCuQGdOrCScqyxbYf8E=; b=AvwZjmW36GeltIntuhJd8mSuYsGe/CcnvMr93kgMUKFjMlxxy6jY4jEz7ErXK9CGx2 LD54FDUSxtdslML8opr+GQpRVilek7V2RY2L1HA5xOt3zwJEVykOnskS6oMzRwr5tRcv XiACBC7ySPIkUr/EFJzAnIKiuNPzaGVt+I8BKn71pfyPjuySOuECjZlmKvKloAruagy4 0hmijWPjx4WIxr1NpPakgIeT5+HI6Ec6FiIinLuir9IydgNbSOpq8c7QjI/jFI1NN6cG HcYKHe688GYnHOQS/Ea1qqgpNlmmUERSIsH7r/8c3YDsIvO7pTMZCrDGOzfrVHyTBRBe DruA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZHxLno14; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id r3-20020a632b03000000b005b9a45633ffsi9669878pgr.446.2023.11.15.01.05.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 01:05:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=ZHxLno14; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id AA1C881373F9; Wed, 15 Nov 2023 01:05:18 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234761AbjKOJFL (ORCPT + 28 others); Wed, 15 Nov 2023 04:05:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234701AbjKOJE5 (ORCPT ); Wed, 15 Nov 2023 04:04:57 -0500 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 89BA0114; Wed, 15 Nov 2023 01:04:53 -0800 (PST) Date: Wed, 15 Nov 2023 09:04:51 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1700039091; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FDYsmJeTGcPNQRpxou+VlALaTQpSQyDGIv5As9gc9js=; b=ZHxLno14T3avnGOVyQTCdzFl0NZd4WrHfom2xm6W+LRn6s44QG/fR2s15IQTZyL/R4LVqO A43uskeZlox9JOhSmeGmtPVoGd7AQWXpSbQjnQA+MfIs76pM1vX8R5W6xARsqMbNHBmMSN 5ApBswkP53wLdPp/ccM1FufZxBCnEyo/g+LtBiaoIlIx5pKgopv9JFA3tWH131lLqcX0yk U6OAHb8uiX73W+mK011TxKW/lP3b4b6bF4UkAas8Bu6dW9yGq84+WldxvvrG6vgvt88VyF XBE2cxa6kmEIntK/FjB5PCxHolb06fbot1+tL8zeiF8yY94c0sa9RZNrkZa9kg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1700039091; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FDYsmJeTGcPNQRpxou+VlALaTQpSQyDGIv5As9gc9js=; b=JABlld+YPwGieHBg10FDZpvApvNp0M2m+ruOMUGncTgXZa0gPB79foxhYO1IF6UDRMirN5 4l0kO/86gAGIvPBA== From: "tip-bot2 for Peter Zijlstra" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/deadline: Collect sched_dl_entity initialization Cc: "Peter Zijlstra (Intel)" , Daniel Bristot de Oliveira , Phil Auld , Valentin Schneider , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <51acc695eecf0a1a2f78f9a044e11ffd9b316bcf.1699095159.git.bristot@kernel.org> References: <51acc695eecf0a1a2f78f9a044e11ffd9b316bcf.1699095159.git.bristot@kernel.org> MIME-Version: 1.0 Message-ID: <170003909113.391.17311843360585530525.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 01:05:18 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1781630949818347616 X-GMAIL-MSGID: 1782620229281383566 The following commit has been merged into the sched/core branch of tip: Commit-ID: 9e07d45c5210f5dd6701c00d55791983db7320fa Gitweb: https://git.kernel.org/tip/9e07d45c5210f5dd6701c00d55791983db7320fa Author: Peter Zijlstra AuthorDate: Sat, 04 Nov 2023 11:59:19 +01:00 Committer: Peter Zijlstra CommitterDate: Wed, 15 Nov 2023 09:57:50 +01:00 sched/deadline: Collect sched_dl_entity initialization Create a single function that initializes a sched_dl_entity. Signed-off-by: Peter Zijlstra (Intel) Signed-off-by: Daniel Bristot de Oliveira Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Phil Auld Reviewed-by: Valentin Schneider Link: https://lkml.kernel.org/r/51acc695eecf0a1a2f78f9a044e11ffd9b316bcf.1699095159.git.bristot@kernel.org --- kernel/sched/core.c | 5 +---- kernel/sched/deadline.c | 22 +++++++++++++++------- kernel/sched/sched.h | 5 +---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 9d5099d..966631f 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -4511,10 +4511,7 @@ static void __sched_fork(unsigned long clone_flags, struct task_struct *p) memset(&p->stats, 0, sizeof(p->stats)); #endif - RB_CLEAR_NODE(&p->dl.rb_node); - init_dl_task_timer(&p->dl); - init_dl_inactive_task_timer(&p->dl); - __dl_clear_params(p); + init_dl_entity(&p->dl); INIT_LIST_HEAD(&p->rt.run_list); p->rt.timeout = 0; diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c index de79719..e80bb88 100644 --- a/kernel/sched/deadline.c +++ b/kernel/sched/deadline.c @@ -335,6 +335,8 @@ static void dl_change_utilization(struct task_struct *p, u64 new_bw) __add_rq_bw(new_bw, &rq->dl); } +static void __dl_clear_params(struct sched_dl_entity *dl_se); + /* * The utilization of a task cannot be immediately removed from * the rq active utilization (running_bw) when the task blocks. @@ -434,7 +436,7 @@ static void task_non_contending(struct task_struct *p) raw_spin_lock(&dl_b->lock); __dl_sub(dl_b, p->dl.dl_bw, dl_bw_cpus(task_cpu(p))); raw_spin_unlock(&dl_b->lock); - __dl_clear_params(p); + __dl_clear_params(dl_se); } return; @@ -1183,7 +1185,7 @@ unlock: return HRTIMER_NORESTART; } -void init_dl_task_timer(struct sched_dl_entity *dl_se) +static void init_dl_task_timer(struct sched_dl_entity *dl_se) { struct hrtimer *timer = &dl_se->dl_timer; @@ -1389,7 +1391,7 @@ static enum hrtimer_restart inactive_task_timer(struct hrtimer *timer) raw_spin_lock(&dl_b->lock); __dl_sub(dl_b, p->dl.dl_bw, dl_bw_cpus(task_cpu(p))); raw_spin_unlock(&dl_b->lock); - __dl_clear_params(p); + __dl_clear_params(dl_se); goto unlock; } @@ -1405,7 +1407,7 @@ unlock: return HRTIMER_NORESTART; } -void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se) +static void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se) { struct hrtimer *timer = &dl_se->inactive_timer; @@ -2957,10 +2959,8 @@ bool __checkparam_dl(const struct sched_attr *attr) /* * This function clears the sched_dl_entity static params. */ -void __dl_clear_params(struct task_struct *p) +static void __dl_clear_params(struct sched_dl_entity *dl_se) { - struct sched_dl_entity *dl_se = &p->dl; - dl_se->dl_runtime = 0; dl_se->dl_deadline = 0; dl_se->dl_period = 0; @@ -2978,6 +2978,14 @@ void __dl_clear_params(struct task_struct *p) #endif } +void init_dl_entity(struct sched_dl_entity *dl_se) +{ + RB_CLEAR_NODE(&dl_se->rb_node); + init_dl_task_timer(dl_se); + init_dl_inactive_task_timer(dl_se); + __dl_clear_params(dl_se); +} + bool dl_param_changed(struct task_struct *p, const struct sched_attr *attr) { struct sched_dl_entity *dl_se = &p->dl; diff --git a/kernel/sched/sched.h b/kernel/sched/sched.h index 6703e9e..3c62df1 100644 --- a/kernel/sched/sched.h +++ b/kernel/sched/sched.h @@ -273,8 +273,6 @@ struct rt_bandwidth { unsigned int rt_period_active; }; -void __dl_clear_params(struct task_struct *p); - static inline int dl_bandwidth_enabled(void) { return sysctl_sched_rt_runtime >= 0; @@ -2427,8 +2425,7 @@ extern struct rt_bandwidth def_rt_bandwidth; extern void init_rt_bandwidth(struct rt_bandwidth *rt_b, u64 period, u64 runtime); extern bool sched_rt_bandwidth_account(struct rt_rq *rt_rq); -extern void init_dl_task_timer(struct sched_dl_entity *dl_se); -extern void init_dl_inactive_task_timer(struct sched_dl_entity *dl_se); +extern void init_dl_entity(struct sched_dl_entity *dl_se); #define BW_SHIFT 20 #define BW_UNIT (1 << BW_SHIFT)