public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Phil Auld <pauld@redhat.com>
To: Juri Lelli <juri.lelli@redhat.com>
Cc: Waiman Long <longman@redhat.com>, Tejun Heo <tj@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Michal Koutny <mkoutny@suse.com>, Ingo Molnar <mingo@redhat.com>,
	Peter Zijlstra <peterz@infradead.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Dietmar Eggemann <dietmar.eggemann@arm.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Ben Segall <bsegall@google.com>, Mel Gorman <mgorman@suse.de>,
	Valentin Schneider <vschneid@redhat.com>,
	Qais Yousef <qyousef@layalina.io>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	"Joel Fernandes (Google)" <joel@joelfernandes.org>,
	Suleiman Souhlal <suleiman@google.com>,
	Aashish Sharma <shraash@google.com>,
	Shin Kawamura <kawasin@google.com>,
	Vineeth Remanan Pillai <vineeth@bitbyteword.org>,
	linux-kernel@vger.kernel.org, cgroups@vger.kernel.org
Subject: Re: [PATCH v2 1/2] sched/deadline: Restore dl_server bandwidth on non-destructive root domain changes
Date: Thu, 14 Nov 2024 10:56:03 -0500	[thread overview]
Message-ID: <20241114155603.GC471026@pauld.westford.csb> (raw)
In-Reply-To: <20241114142810.794657-2-juri.lelli@redhat.com>

On Thu, Nov 14, 2024 at 02:28:09PM +0000 Juri Lelli wrote:
> When root domain non-destructive changes (e.g., only modifying one of
> the existing root domains while the rest is not touched) happen we still
> need to clear DEADLINE bandwidth accounting so that it's then properly
> restored, taking into account DEADLINE tasks associated to each cpuset
> (associated to each root domain). After the introduction of dl_servers,
> we fail to restore such servers contribution after non-destructive
> changes (as they are only considered on destructive changes when
> runqueues are attached to the new domains).
> 
> Fix this by making sure we iterate over the dl_servers attached to
> domains that have not been destroyed and add their bandwidth
> contribution back correctly.
> 
> Signed-off-by: Juri Lelli <juri.lelli@redhat.com>
>


Reviewed-by: Phil Auld <pauld@redhat.com>


> ---
> v1->v2: always restore, considering a root domain span (and check for
>         active cpus)
> ---
>  kernel/sched/deadline.c | 17 ++++++++++++++---
>  kernel/sched/topology.c |  8 +++++---
>  2 files changed, 19 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/sched/deadline.c b/kernel/sched/deadline.c
> index 9ce93d0bf452..a9cdbf058871 100644
> --- a/kernel/sched/deadline.c
> +++ b/kernel/sched/deadline.c
> @@ -2970,11 +2970,22 @@ void dl_add_task_root_domain(struct task_struct *p)
>  
>  void dl_clear_root_domain(struct root_domain *rd)
>  {
> -	unsigned long flags;
> +	int i;
>  
> -	raw_spin_lock_irqsave(&rd->dl_bw.lock, flags);
> +	guard(raw_spinlock_irqsave)(&rd->dl_bw.lock);
>  	rd->dl_bw.total_bw = 0;
> -	raw_spin_unlock_irqrestore(&rd->dl_bw.lock, flags);
> +
> +	/*
> +	 * dl_server bandwidth is only restored when CPUs are attached to root
> +	 * domains (after domains are created or CPUs moved back to the
> +	 * default root doamin).
> +	 */
> +	for_each_cpu(i, rd->span) {
> +		struct sched_dl_entity *dl_se = &cpu_rq(i)->fair_server;
> +
> +		if (dl_server(dl_se) && cpu_active(i))
> +			rd->dl_bw.total_bw += dl_se->dl_bw;
> +	}
>  }
>  
>  #endif /* CONFIG_SMP */
> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
> index 9748a4c8d668..9c405f0e7b26 100644
> --- a/kernel/sched/topology.c
> +++ b/kernel/sched/topology.c
> @@ -2721,9 +2721,11 @@ void partition_sched_domains_locked(int ndoms_new, cpumask_var_t doms_new[],
>  
>  				/*
>  				 * This domain won't be destroyed and as such
> -				 * its dl_bw->total_bw needs to be cleared.  It
> -				 * will be recomputed in function
> -				 * update_tasks_root_domain().
> +				 * its dl_bw->total_bw needs to be cleared.
> +				 * Tasks contribution will be then recomputed
> +				 * in function dl_update_tasks_root_domain(),
> +				 * dl_servers contribution in function
> +				 * dl_restore_server_root_domain().
>  				 */
>  				rd = cpu_rq(cpumask_any(doms_cur[i]))->rd;
>  				dl_clear_root_domain(rd);
> -- 
> 2.47.0
> 

-- 


  reply	other threads:[~2024-11-14 15:56 UTC|newest]

Thread overview: 83+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-14 14:28 [PATCH v2 0/2] Fix DEADLINE bandwidth accounting in root domain changes and hotplug Juri Lelli
2024-11-14 14:28 ` [PATCH v2 1/2] sched/deadline: Restore dl_server bandwidth on non-destructive root domain changes Juri Lelli
2024-11-14 15:56   ` Phil Auld [this message]
2024-12-02 11:14   ` [tip: sched/core] " tip-bot2 for Juri Lelli
2024-11-14 14:28 ` [PATCH v2 2/2] sched/deadline: Correctly account for allocated bandwidth during hotplug Juri Lelli
2024-11-14 15:58   ` Phil Auld
2024-12-02 11:14   ` [tip: sched/core] " tip-bot2 for Juri Lelli
2024-12-06 10:43   ` [PATCH v2 2/2] " Dan Carpenter
2024-12-09 14:20     ` Juri Lelli
2024-11-14 15:48 ` [PATCH v2 0/2] Fix DEADLINE bandwidth accounting in root domain changes and hotplug Waiman Long
2024-11-14 16:14 ` Juri Lelli
2024-11-14 18:16   ` Waiman Long
2024-11-14 18:43   ` Phil Auld
2024-11-15 11:48   ` [PATCH v2 3/2] sched/deadline: Check bandwidth overflow earlier for hotplug Juri Lelli
2024-12-02 11:14     ` [tip: sched/core] " tip-bot2 for Juri Lelli
2025-01-10 11:52     ` [PATCH v2 3/2] " Jon Hunter
2025-01-10 15:45       ` Juri Lelli
2025-01-10 18:40         ` Jon Hunter
2025-01-13  9:32           ` Juri Lelli
2025-01-13 13:53             ` Jon Hunter
2025-01-14 13:52             ` Jon Hunter
2025-01-14 14:02               ` Juri Lelli
2025-01-15 16:10                 ` Juri Lelli
2025-01-16 13:14                   ` Jon Hunter
2025-01-16 15:55                     ` Juri Lelli
2025-02-03 11:01                       ` Jon Hunter
2025-02-04 17:26                         ` Juri Lelli
2025-02-05  6:53                         ` Juri Lelli
2025-02-05 10:12                           ` Juri Lelli
2025-02-05 16:56                             ` Jon Hunter
2025-02-06  9:29                               ` Juri Lelli
2025-02-07 10:38                                 ` Jon Hunter
2025-02-07 13:38                                   ` Dietmar Eggemann
2025-02-07 14:04                                     ` Jon Hunter
2025-02-07 15:55                                       ` Christian Loehle
2025-02-10 17:09                                         ` Juri Lelli
2025-02-11  8:36                                           ` Dietmar Eggemann
2025-02-11  9:21                                             ` Juri Lelli
2025-02-11 10:43                                               ` Dietmar Eggemann
2025-02-11 10:15                                           ` Christian Loehle
2025-02-11 10:42                                             ` Juri Lelli
2025-02-12 18:22                                               ` Dietmar Eggemann
2025-02-13  6:20                                                 ` Juri Lelli
2025-02-13 12:27                                                   ` Christian Loehle
2025-02-13 13:33                                                     ` Juri Lelli
2025-02-13 13:38                                                       ` Christian Loehle
2025-02-13 14:51                                                         ` Juri Lelli
2025-02-13 14:57                                                           ` Christian Loehle
2025-02-16 16:33                                                   ` Qais Yousef
2025-02-17 14:52                                                     ` Juri Lelli
2025-02-22 23:59                                                       ` Qais Yousef
2025-02-24  9:27                                                         ` Juri Lelli
2025-02-25  0:02                                                           ` Qais Yousef
2025-02-25  9:46                                                             ` Juri Lelli
2025-02-25 10:09                                                               ` Christian Loehle
2025-02-12 23:01                                               ` Jon Hunter
2025-02-13  6:16                                                 ` Juri Lelli
2025-02-13  9:53                                                   ` Jon Hunter
2025-02-14 10:05                                                     ` Jon Hunter
2025-02-17 16:08                                                       ` Juri Lelli
2025-02-17 16:10                                                         ` Jon Hunter
2025-02-17 16:25                                                           ` Juri Lelli
2025-02-18  9:58                                                         ` Juri Lelli
2025-02-18 10:30                                                           ` Juri Lelli
2025-02-18 14:12                                                           ` Dietmar Eggemann
2025-02-18 14:18                                                             ` Juri Lelli
2025-02-19  9:29                                                               ` Dietmar Eggemann
2025-02-19 10:02                                                                 ` Juri Lelli
2025-02-19 11:23                                                                   ` Jon Hunter
2025-02-19 13:09                                                                   ` Dietmar Eggemann
2025-02-19 18:14                                                                     ` Dietmar Eggemann
2025-02-20 10:40                                                                       ` Juri Lelli
2025-02-20 15:25                                                                         ` Juri Lelli
2025-02-21 11:56                                                                           ` Jon Hunter
2025-02-21 14:45                                                                             ` Dietmar Eggemann
2025-02-24 13:53                                                                               ` Dietmar Eggemann
2025-02-24 14:03                                                                                 ` Juri Lelli
2025-02-24 23:39                                                                                   ` Jon Hunter
2025-02-25  9:48                                                                                     ` Juri Lelli
2025-03-03 14:17                                                                                       ` Jon Hunter
2025-03-03 16:00                                                                                         ` Juri Lelli
2025-02-07 14:04                                     ` Jon Hunter
2025-02-07 15:52                                   ` Juri Lelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241114155603.GC471026@pauld.westford.csb \
    --to=pauld@redhat.com \
    --cc=bigeasy@linutronix.de \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=dietmar.eggemann@arm.com \
    --cc=hannes@cmpxchg.org \
    --cc=joel@joelfernandes.org \
    --cc=juri.lelli@redhat.com \
    --cc=kawasin@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=longman@redhat.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=peterz@infradead.org \
    --cc=qyousef@layalina.io \
    --cc=rostedt@goodmis.org \
    --cc=shraash@google.com \
    --cc=suleiman@google.com \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vineeth@bitbyteword.org \
    --cc=vschneid@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox