From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A47C9C6FD18 for ; Wed, 29 Mar 2023 16:39:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230174AbjC2Qjj (ORCPT ); Wed, 29 Mar 2023 12:39:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229638AbjC2Qjh (ORCPT ); Wed, 29 Mar 2023 12:39:37 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id EE9F5A7; Wed, 29 Mar 2023 09:39:36 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EA20A1FB; Wed, 29 Mar 2023 09:40:20 -0700 (PDT) Received: from [192.168.178.6] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 124B53F6C4; Wed, 29 Mar 2023 09:39:32 -0700 (PDT) Message-ID: Date: Wed, 29 Mar 2023 18:39:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH 5/6] cgroup/cpuset: Free DL BW in case can_attach() fails Content-Language: en-US To: Waiman Long , Juri Lelli , Peter Zijlstra , Ingo Molnar , Qais Yousef , Tejun Heo , Zefan Li , Johannes Weiner , Hao Luo Cc: Steven Rostedt , linux-kernel@vger.kernel.org, luca.abeni@santannapisa.it, claudio@evidence.eu.com, tommaso.cucinotta@santannapisa.it, bristot@redhat.com, mathieu.poirier@linaro.org, cgroups@vger.kernel.org, Vincent Guittot , Wei Wang , Rick Yiu , Quentin Perret , Heiko Carstens , Vasily Gorbik , Alexander Gordeev , Sudeep Holla References: <20230329125558.255239-1-juri.lelli@redhat.com> <20230329125558.255239-6-juri.lelli@redhat.com> From: Dietmar Eggemann In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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?