From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dietmar Eggemann Subject: Re: [PATCH 5/6] cgroup/cpuset: Free DL BW in case can_attach() fails Date: Thu, 30 Mar 2023 17:14:06 +0200 Message-ID: <5ff103f9-1366-0a9b-bd97-419ced1de07f@arm.com> References: <20230329125558.255239-1-juri.lelli@redhat.com> <20230329125558.255239-6-juri.lelli@redhat.com> Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Return-path: Content-Language: en-US In-Reply-To: List-ID: Content-Type: text/plain; charset="utf-8" To: Waiman Long , Juri Lelli , Peter Zijlstra , Ingo Molnar , Qais Yousef , Tejun Heo , Zefan Li , Johannes Weiner , Hao Luo Cc: Steven Rostedt , linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, luca.abeni-5rdYK369eBLQB0XuIGIEkQ@public.gmane.org, claudio-YOzL5CV4y4YG1A2ADO40+w@public.gmane.org, tommaso.cucinotta-5rdYK369eBLQB0XuIGIEkQ@public.gmane.org, bristot-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, mathieu.poirier-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Vincent Guittot , Wei Wang , Rick Yiu , Quentin Perret , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sudeep Holla On 29/03/2023 20:09, Waiman Long wrote: > On 3/29/23 12:39, Dietmar Eggemann wrote: >> On 29/03/2023 16:31, Waiman Long wrote: >>> On 3/29/23 10:25, Waiman Long wrote: >>>> On 3/29/23 08:55, Juri Lelli wrote: >>>>> From: Dietmar Eggemann >> [...] >> >>>>> @@ -2518,11 +2547,21 @@ static int cpuset_can_attach(struct >>>>> cgroup_taskset *tset) >>>>>    static void cpuset_cancel_attach(struct cgroup_taskset *tset) >>>>>    { >>>>>        struct cgroup_subsys_state *css; >>>>> +    struct cpuset *cs; >>>>>          cgroup_taskset_first(tset, &css); >>>>> +    cs = css_cs(css); >>>>>          mutex_lock(&cpuset_mutex); >>>>> -    css_cs(css)->attach_in_progress--; >>>>> +    cs->attach_in_progress--; >>>>> + >>>>> +    if (cs->nr_migrate_dl_tasks) { >>>>> +        int cpu = cpumask_any(cs->effective_cpus); >>>>> + >>>>> +        dl_bw_free(cpu, cs->sum_migrate_dl_bw); >>>>> +        reset_migrate_dl_data(cs); >>>>> +    } >>>>> + >>> Another nit that I have is that you may have to record also the cpu >>> where the DL bandwidth is allocated in cpuset_can_attach() and free the >>> bandwidth back into that cpu or there can be an underflow if another cpu >>> is chosen. >> Many thanks for the review! >> >> But isn't the DL BW control `struct dl_bw` per `struct root_domain` >> which is per exclusive cpuset. So as long cpu is from >> `cs->effective_cpus` shouldn't this be fine? > > Sorry for my ignorance on how the deadline bandwidth operation work. I > check the bandwidth code and find that we are storing the bandwidth > information in the root domain, not on the cpu. That shouldn't be a > concern then. > > However, I still have some question on how that works when dealing with > cpuset. First of all, not all the CPUs in a given root domains are in > the cpuset. So there may be enough bandwidth on the root domain, but it > doesn't mean there will be enough bandwidth in the set of CPUs in a > particular cpuset. Secondly, how do you deal with isolated CPUs that do > not have a corresponding root domain? It is now possible to create a > cpuset with isolated CPUs. Sorry, I overlooked this email somehow. IMHO, this is only done for exclusive cpusets: cpuset_can_attach() if (!cpumask_intersects(oldcs->effective_cpus, cs->effective_cpus)) So they should have their own root_domain congruent to their cpumask.