Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp2380013rwl; Thu, 30 Mar 2023 09:29:10 -0700 (PDT) X-Google-Smtp-Source: AKy350Yrn3dSHz1W7WQezdqYsbTTzyH4Il7bTEsxA+cZo5xAw/LsXTvGAZ0kWZf3Tgi3Zn6CJDuL X-Received: by 2002:a05:6402:34c6:b0:502:92d:4f50 with SMTP id w6-20020a05640234c600b00502092d4f50mr3852384edc.1.1680193750102; Thu, 30 Mar 2023 09:29:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680193750; cv=none; d=google.com; s=arc-20160816; b=LPfPO6MpJ4eyroTuuWllb/QsuUrC+VQZV1u6ddO0yKcZMFeGmByQz81vUErVw/sEUD cZEqMU+VVssBQdWiJshOLS9idAeu5vJeP6NOOZ0hj/K18gHSrYxgFCS7vlpPrcqggHAL 7C+KsU6JOoNE6N8aLEOVR/sF5Cx5+8xc6kx/s9Y4VTVRvENFN0+HE2nc18M0rsobmeAS GkCo2IpUj8tuyBDI3lhqrLl3JYuVZjyUicmXqiPYUutXZyD8JhkVbVGBuCmjQpx3CvSj d7NI2lcxYKjePFL335hI8taouqLXYqPHdFwNU62R9MxBhBotT/gZ4+kv6NKDrXL4TN5J b1LA== 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=i+HJ4WLfm8Z01D2cI/A0RfbJSBHfv/6mLfrOQoLhihI=; b=gaHn4gN8xljApvEF9iz0QSFRYOyP9QPWIZ71idDIAKL+zDCbCiApuGC7h4tR9d2rv1 Vo518tslIMbExQKLWlvUXtlns3s/e2fgeTk/ReyrpVLJH2v9iNQt0T8IN59Av/WcXWL7 dUbtcKuE/IP3Q9T14Eb+vYheJDIidolDPmYd3eTebjl3/tYZ0bdhxfO8EmfS8W0V7/a1 cbO8+4EDtIfgWI2IJhWoJEyAjK8zxwVITDZk6L1+L1SG8Loe7HquupWn+JkhbNG2wDQn Mv7usiIafKvsMAqoeTCXlPRJTBofYSrnqB6BV0HP6nrwsfo23gf6R570EehaS4To8qhU 1jXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=co7ujp5q; 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 u23-20020aa7d897000000b00501df17fe9fsi167621edq.78.2023.03.30.09.28.44; Thu, 30 Mar 2023 09:29:10 -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=co7ujp5q; 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 S231431AbjC3QOx (ORCPT + 99 others); Thu, 30 Mar 2023 12:14:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44296 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231725AbjC3QOo (ORCPT ); Thu, 30 Mar 2023 12:14:44 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2277EB76 for ; Thu, 30 Mar 2023 09:13:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1680192796; 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=i+HJ4WLfm8Z01D2cI/A0RfbJSBHfv/6mLfrOQoLhihI=; b=co7ujp5qUL/OpZZaSoZ6+Dx7Tcxuhv27nma2OYyKSZKHxTZDWicCEkcpMX/2QsVDfcvpZ1 72Q63JbZ6o/UEXSbpTgBsjzkpgyPk8f0MhK9kMdoCC8YFiGn7Cys+wpazleH3lok4D8KU6 LYnLALnlx65YEs496mkG7nihTPMyyTk= 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-152-f7E3ZRQAP965kJ04DbTPXQ-1; Thu, 30 Mar 2023 12:13:11 -0400 X-MC-Unique: f7E3ZRQAP965kJ04DbTPXQ-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 7A603857FB3; Thu, 30 Mar 2023 16:13:05 +0000 (UTC) Received: from [10.22.33.26] (unknown [10.22.33.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 36455202701F; Thu, 30 Mar 2023 16:13:03 +0000 (UTC) Message-ID: <3268bedc-ee36-519a-de37-3c366129baae@redhat.com> Date: Thu, 30 Mar 2023 12:13:02 -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> <5ff103f9-1366-0a9b-bd97-419ced1de07f@arm.com> From: Waiman Long In-Reply-To: <5ff103f9-1366-0a9b-bd97-419ced1de07f@arm.com> 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/30/23 11:14, Dietmar Eggemann wrote: > 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. I am sorry that I missed that check. Parallel attach is actually an existing problem in cpuset as there is a shared cpuset_attach_old_cs variable being used by cpuset between cpuset_can_attach() and cpuset_attach(). So any parallel attach can lead to corruption of this common data causing incorrect result. So this problem is not specific to this patch series. So please ignore this patch for now. It has to be addressed separately. Cheers, Longman