Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp1007754rwl; Wed, 29 Mar 2023 11:13:40 -0700 (PDT) X-Google-Smtp-Source: AKy350bmgWOWESySopDgO0HCCyxvTUsjFQ1J9XXBlBHJkdczwJ6qGGW8cxnObqMyXGcFOaZII+Fu X-Received: by 2002:a17:906:a24f:b0:931:bc69:8f94 with SMTP id bi15-20020a170906a24f00b00931bc698f94mr20973826ejb.45.1680113620263; Wed, 29 Mar 2023 11:13:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680113620; cv=none; d=google.com; s=arc-20160816; b=xmHR1H51kwSy1DXaY9Cq0PytqS91JVQxZd+7v/6zeXRoyVNSwEtKEBmG/YXs5Byvhw JkS1Da1qOHxwiBL74IjfvuMZxU2QfgfAlEcpn5xJ6L6flfnMLvA26ZLS2thFFfs3x0ec S+zcLVMR0eTqadyYmHiWAAAXf+Mavo92MHKUJKRzDnnz/cDqjKW7TrUn0omcRKwVY0H+ jS2yesKhREmegWTlmH/wfvkYj8yhFdhK0TdU+JpgZxzh/8Hv7por6T6OYYWXYexQgc8W quWeQXrAI56JVq+9/vs2FwF6zXxhWhL2NSW3WJ9blU+DGymPVutYk1710CWyAU09gNx5 wb9w== 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:dkim-signature; bh=H8vliQ1ONvrTK4LTfw9x6DXO/qnrs4SgkkW8WifHRpE=; b=CHZtcJCFoZlxoEjzAbh0gYMjYfehFFs5T0918lrP1PAGUskflYKanR2MKQV4lQvFUx p8EvCwCPnr/T5aalshpdJN7wGe8WLz1Ycopd4fQ8V2tUL00Qwwdsn+Bzr7S7Ux+hf3k2 zr93joAH9nRr4a4yB+LVGEm88Ibofwp2jsMyHs4T8IvjzIRzQwBZEM/lgMf2p0NLRRhm 3NTXB3qcC9bQfOxHo4v12wr7NgtwcCDN9UYwK6V99S0QDkUTcJFbgT2VCudp4yEYGVPQ tKDtbRenSQsdruJ5msdt1R0jculEkx/u6F8QxKIlBREnMUUN8i9ZYHg0Ya0nHh/LCL0j Vj8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JFWWNQyh; 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 t2-20020a1709063e4200b0092d55987bcesi28065373eji.268.2023.03.29.11.13.16; Wed, 29 Mar 2023 11:13:40 -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=JFWWNQyh; 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 S229615AbjC2SMS (ORCPT + 99 others); Wed, 29 Mar 2023 14:12:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229481AbjC2SMM (ORCPT ); Wed, 29 Mar 2023 14:12:12 -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 A1D336A44 for ; Wed, 29 Mar 2023 11:11:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680113390; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=H8vliQ1ONvrTK4LTfw9x6DXO/qnrs4SgkkW8WifHRpE=; b=JFWWNQyhZ3sft7xKrxptJ749a5TkK8nN03SdEkpwnDnJVlld5avqyWoq+29NMkk/GNNXbt Fkhfp+6FvvekkoIUc29yU5fg+Ex18MIgd2MRpJj94+156DU8IkrFBlbcOJlBdHNYSZELGX /JdDX2n9Jfsw+3KWYBkH9ZoAt5a+v2Y= 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-323-BA8Ormx2Nd6GNGSaMivOkg-1; Wed, 29 Mar 2023 14:09:47 -0400 X-MC-Unique: BA8Ormx2Nd6GNGSaMivOkg-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 81F31811E7C; Wed, 29 Mar 2023 18:09:44 +0000 (UTC) Received: from [10.22.34.224] (unknown [10.22.34.224]) by smtp.corp.redhat.com (Postfix) with ESMTP id 0DE05202701E; Wed, 29 Mar 2023 18:09:43 +0000 (UTC) Message-ID: Date: Wed, 29 Mar 2023 14:09:42 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.7.1 Subject: Re: [PATCH 5/6] cgroup/cpuset: Free DL BW in case can_attach() fails Content-Language: en-US To: Dietmar Eggemann , 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: Waiman Long In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Spam-Status: No, score=-0.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,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 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. Cheers, Longman