Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp1289592rwd; Tue, 13 Jun 2023 07:19:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ69/YWFw1fWuYTA9PwpLquvbIkpnepnJ4uCwBsFObqCK8bQt+u6lStMVtmCNrH714dM3ni+ X-Received: by 2002:a17:902:6b0b:b0:1b1:9d3c:66c9 with SMTP id o11-20020a1709026b0b00b001b19d3c66c9mr8721765plk.5.1686665970839; Tue, 13 Jun 2023 07:19:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686665970; cv=none; d=google.com; s=arc-20160816; b=kQkSv0BeZa3Fu7Ocxw17r0QIJTxhmozECCZkIQRHj7h2B8O62SfZLoBN6H6GzdTlVu VzF79b5SARVQEz4WYTzUiYhb5lH41yPRus9Sy6MkLiCu1yWX7TkNXDT60npqQ0vNYRLx dIw0uby6MJpld1HGDgeis8pASRP4CumIFvxhsnMUqwSZoVHBFCbJs+qdHOXrD4GZVXYz hsP7pnkeLhNH8ebWjyUpQqKewv4vwMWxtC6xRaI5RyOUTeCRdiXzwAJIweUFwNtklZVG dgsCQZBFarI7jJ9QRPiG8Th7l34o3igjsR6bEBtZXhCMTrh+VFeqW1oaeM2XsIBUOYQJ qWfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=/mfjHT7nuV4AfGG0oJKGlKVHxkxgF2g4IG6Spxt4sW8=; b=nt3UEUhRTF8LzYT2WUBztWWBYf9jCbKAMozmTYrDbh0n/Knk5goex22zinCVevetlc xOXENWY9ROd9xnZLxWrAdJ7nwkxDsCvmqwfinjCa2kL42OeWi7pRjv9Zkvymu7Ts6QCt AwWD3qlhWDqs/dQiuLrwZrF+dN82sRM68iuRda3u0ycWEEJUK1qOJT3VbRK3jtTIrqx+ xHNTYYuC93yN4CiMXSBsa84+/KbtLkwCaUgpxqeSUFVIBAuFeums8hhYwgFHycqXZVeu ZPVD2rcVjbuqzN9FJ8mfnX442QL8TaXWL4t4yEtlAeqAo/PGkCGapYkL5Y04li1thS9D oFNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qnzw5jDs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w4-20020a1709029a8400b001afe110eb66si1082951plp.532.2023.06.13.07.19.10; Tue, 13 Jun 2023 07:19:30 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qnzw5jDs; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240689AbjFMN1Q (ORCPT + 99 others); Tue, 13 Jun 2023 09:27:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240668AbjFMN1O (ORCPT ); Tue, 13 Jun 2023 09:27:14 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 043AEE56 for ; Tue, 13 Jun 2023 06:26:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1686662788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=/mfjHT7nuV4AfGG0oJKGlKVHxkxgF2g4IG6Spxt4sW8=; b=Qnzw5jDsE3jh9LnspAzsl492ValcOOhcd7ADS3+pDJCwHqRkFpYnL8GlHJOhDSzeMth5Ra 3UuBvMxrlZHUyDWr/qoAYQBt9qwW7uKqh1A+qYvvsD0/nEx2mR4EMo23zPPIcN9j0MO2DV rYK3AW4ZouqO1JnOXxeqPA0Pt0Xo+iQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-581-ayrKN39cPACI0MHbCIFtNA-1; Tue, 13 Jun 2023 09:26:16 -0400 X-MC-Unique: ayrKN39cPACI0MHbCIFtNA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 08704101B059; Tue, 13 Jun 2023 13:26:00 +0000 (UTC) Received: from lorien.usersys.redhat.com (unknown [10.39.193.76]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2C51140C20F5; Tue, 13 Jun 2023 13:25:53 +0000 (UTC) Date: Tue, 13 Jun 2023 09:25:50 -0400 From: Phil Auld To: Daniel Bristot de Oliveira Cc: Ingo Molnar , Peter Zijlstra , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , Valentin Schneider , linux-kernel@vger.kernel.org, Luca Abeni , Tommaso Cucinotta , Thomas Gleixner , Joel Fernandes , Vineeth Pillai , Shuah Khan Subject: Re: [RFC PATCH V3 2/6] sched/deadline: Collect sched_dl_entity initialization Message-ID: <20230613132550.GD536267@lorien.usersys.redhat.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.1 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_NONE,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 On Thu, Jun 08, 2023 at 05:58:14PM +0200 Daniel Bristot de Oliveira wrote: > From: Peter Zijlstra > > Create a single function that initializes a sched_dl_entity. > > Signed-off-by: Peter Zijlstra (Intel) > Signed-off-by: Daniel Bristot de Oliveira Reviewed-by: Phil Auld > --- > 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 ac38225e6d09..e34b02cbe41f 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 030e7c11607f..22e5e64812c9 100644 > --- a/kernel/sched/deadline.c > +++ b/kernel/sched/deadline.c > @@ -333,6 +333,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. > @@ -432,7 +434,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; > @@ -1205,7 +1207,7 @@ static enum hrtimer_restart dl_task_timer(struct hrtimer *timer) > 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; > > @@ -1415,7 +1417,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; > } > @@ -1431,7 +1433,7 @@ static enum hrtimer_restart inactive_task_timer(struct hrtimer *timer) > 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; > > @@ -2974,10 +2976,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; > @@ -2995,6 +2995,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 da0cec2fc63a..fa6512070fa7 100644 > --- a/kernel/sched/sched.h > +++ b/kernel/sched/sched.h > @@ -284,8 +284,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; > @@ -2390,8 +2388,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) > -- > 2.40.1 > --