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 56D14C6FA8F for ; Thu, 24 Aug 2023 16:53:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242738AbjHXQwk (ORCPT ); Thu, 24 Aug 2023 12:52:40 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242731AbjHXQwI (ORCPT ); Thu, 24 Aug 2023 12:52:08 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1725DE51 for ; Thu, 24 Aug 2023 09:52:06 -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 14A661007; Thu, 24 Aug 2023 09:52:46 -0700 (PDT) Received: from [10.1.197.60] (eglon.cambridge.arm.com [10.1.197.60]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 04C733F740; Thu, 24 Aug 2023 09:52:02 -0700 (PDT) Message-ID: <86658d9d-0d8b-d39c-2245-8614b0efc2bc@arm.com> Date: Thu, 24 Aug 2023 17:52:01 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux aarch64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v5 04/24] x86/resctrl: Move rmid allocation out of mkdir_rdt_prepare() Content-Language: en-GB To: Fenghua Yu , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Reinette Chatre , Thomas Gleixner , Ingo Molnar , Borislav Petkov , H Peter Anvin , Babu Moger , shameerali.kolothum.thodi@huawei.com, D Scott Phillips OS , carl@os.amperecomputing.com, lcherian@marvell.com, bobo.shaobowang@huawei.com, tan.shaopeng@fujitsu.com, xingxin.hx@openanolis.org, baolin.wang@linux.alibaba.com, Jamie Iles , Xin Hao , peternewman@google.com, dfustini@baylibre.com References: <20230728164254.27562-1-james.morse@arm.com> <20230728164254.27562-5-james.morse@arm.com> From: James Morse 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 Hi Fenghua, On 15/08/2023 01:50, Fenghua Yu wrote: > On 7/28/23 09:42, James Morse wrote: >> RMID are allocated for each monitor or control group directory, because >> each of these needs its own RMID. For control groups, >> rdtgroup_mkdir_ctrl_mon() later goes on to allocate the CLOSID. >> >> MPAM's equivalent of RMID is not an independent number, so can't be >> allocated until the CLOSID is known. An RMID allocation for one CLOSID >> may fail, whereas another may succeed depending on how many monitor >> groups a control group has. >> >> The RMID allocation needs to move to be after the CLOSID has been >> allocated. >> >> Move the RMID allocation out of mkdir_rdt_prepare() to occur in its caller, >> after the mkdir_rdt_prepare() call. This allows the RMID allocator to >> know the CLOSID. >> diff --git a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> index e7178bbbd30f..7c5cfb373d03 100644 >> --- a/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> +++ b/arch/x86/kernel/cpu/resctrl/rdtgroup.c >> @@ -3336,10 +3344,17 @@ static int rdtgroup_mkdir_ctrl_mon(struct kernfs_node *parent_kn, >>       ret = 0; >>         rdtgrp->closid = closid; >> -    ret = rdtgroup_init_alloc(rdtgrp); >> -    if (ret < 0) >> + >> +    ret = mkdir_rdt_prepare_rmid_alloc(rdtgrp); >> +    if (ret) >>           goto out_id_free; > > Is it better to change "out_id_free" to "out_closid_free"? > It's not confused to name it "out_id_free" because only closid is freed. > But this patch introduces new "rmid" free. So it's better to rename the label to > "out_closid_free" and it matches the following "out_rmid_free" as well. Yup, makes sense. I only left the existing code alone to avoid too much churn. This way is much more readable. Thanks, James