Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp904025rwl; Wed, 29 Mar 2023 09:52:43 -0700 (PDT) X-Google-Smtp-Source: AKy350bbWyzf22EqPLp4G/nza3TJ8vlmjxnqJNTSDy846xmerrSOhxbGl3C5h/O86QamlaLvfUso X-Received: by 2002:aa7:c859:0:b0:4fb:78a0:eabe with SMTP id g25-20020aa7c859000000b004fb78a0eabemr21066817edt.14.1680108762996; Wed, 29 Mar 2023 09:52:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680108762; cv=none; d=google.com; s=arc-20160816; b=QzH3PbwHA/WZgLzKjKAN4IQf/vfiLORlL7yq0j/oJ4A8DYhOj/gubS7mrScz8e/o40 xBt3NaEiHhsMhh4yms5fTf2nZMnOPktGWberJjvg6TDz+WjSSItAzk4IaNN0x4V5SYwf WiyXjC3NmtanUtPAfNxvhnwaBnZtoUV6ksN5tNybtsxc6NiR6zAiKKbYfVsRugcNF6tI NeE1oRSQGe6N4w4w9s743Ijnp8b4uP+J00ko/oCCh+30nNY9BOuM3WOzbgFwzpGNY6TF DnhtiYW1e904MfSFAJS8eAInOHWYT4mLsoWtA6m0nq9Puu81RWxaZLpma2YnBFbQBGuG ZfEA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id; bh=U4aMLP5vUA+8Ppe/cbUnYQCmm0bsF0a3J4mI1INdTSE=; b=XI3H84rxvvCc4afFuOemF/Qa7MVlzt1VxgVj5RlZnkM9fFzEAh95CmAtlzK+Q/z27d oKXuqawxxNJY+qYZrVoMhrAu4Rz5sILMW9CwUzWUA+KkfmqFimYPlzUzWB2CbowswVsJ bxa9Cq6JnYqZO7N8IkKzD9T7M3649G/+l8289naiKPwNBM3NcmlKyTt67yCGe09xKzWO L/QfHQVOZ5z1/oUQxiBPpThNdHVVI0LnGoY5/tw1EL8FIp7RYiX56Z1rJgHL5g9aaOea waCUzDtpV4eW4j8BFzk4jW3tYeQe4PxrtrOEvycDk7sSE2YI6N/mXMs/26MYBiPi/IYS reAQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f17-20020a50ee91000000b004c0b7e61b21si11953338edr.365.2023.03.29.09.52.18; Wed, 29 Mar 2023 09:52:42 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230165AbjC2Qji (ORCPT + 99 others); Wed, 29 Mar 2023 12:39:38 -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 X-Spam-Status: No, score=-2.3 required=5.0 tests=NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 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?