Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1466751rwb; Fri, 28 Jul 2023 09:46:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlGUaV0LJfYI9N5I4hXKStrHHnqtv09sJ8HI27FWQuHoxmitHj8z3Qy6O9p8UjRsw41s/Fx8 X-Received: by 2002:a17:90a:9806:b0:268:2311:e8d8 with SMTP id z6-20020a17090a980600b002682311e8d8mr1942672pjo.17.1690562782679; Fri, 28 Jul 2023 09:46:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690562782; cv=none; d=google.com; s=arc-20160816; b=OPPw+v9XL3Vonmu9V4TUMgrVoufst9/2kfwU4eLkNRdx023gbnWI14uHZjbZWqyXzB yG+usmfUSefF8TpP96MbYwcSACqtTtttAKIOWpMa2JqzyqYYrpLaztJRhYw0N17tSd/0 sgZPOv0kv6RvAAvMoMpdhFa52qQcC0PABztZmlhEHpJb+Pkowfn04jvniR9SS1k0HcQe ZgHrt3ImyUfBUC159EkkV2mmok2W78WqSFRONH3qWDAF/Bq5PqBis7npgTXXfWoJOdBO lLqSNxc+Mp9nz5JbKGD/QohOG7QzrRtUXFbbGNJKQnfJp3XN5irehwo28VUwtVihaIW+ SyWA== 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 :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id; bh=uqVxrh6Eb/NphmZynKSQqXOUc8G0CWQry+fQvWlMizQ=; fh=S+zTDNFOrcxQjqo7I1xGa2sCvBXBGJ3M2z4Ak+cz0LU=; b=QgWxLTVCQKQZmmAE6dbnEsw4sp8fXuoEq/cL7wq8JO4Rti3O9cbayhgmeT6tNrtpP4 xhr+kk7uCi5aYnBSsGEW/rnQzt8TweDL9fFF+gA96NFOb2a1xkHnQsO7rD1T58oKTQ3J z5MdjtuXdmIBsl9XFhQSuEwm3KetHiL7XJy6wsK5RMIclO0c8Hh/PZ53khoRMoMuH2F5 Or+9v1VLPYBSWOnc11YRbVQTEGNd7qNJVVZLHpvH7nQh1eWs9L7G08mwAE6Yjs4gWayS SlWQK4TZK//5Z3ijKp6Dh7qw2Yt84uRQqKDCpPqSkN5+YUhTO5ljgjyBsOJG6VYSwLEZ IBWQ== 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 p7-20020a17090ab90700b002567ce1c798si3371613pjr.137.2023.07.28.09.46.08; Fri, 28 Jul 2023 09:46:22 -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 S231232AbjG1QgA (ORCPT + 99 others); Fri, 28 Jul 2023 12:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233577AbjG1Qft (ORCPT ); Fri, 28 Jul 2023 12:35:49 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A19D34211 for ; Fri, 28 Jul 2023 09:35:32 -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 6ADA92F4; Fri, 28 Jul 2023 09:36:14 -0700 (PDT) Received: from [10.1.27.148] (e125956.cambridge.arm.com [10.1.27.148]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 663E53F67D; Fri, 28 Jul 2023 09:35:27 -0700 (PDT) Message-ID: Date: Fri, 28 Jul 2023 17:35:20 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 From: James Morse Subject: Re: [PATCH v4 08/24] x86/resctrl: Allocate the cleanest CLOSID by searching closid_num_dirty_rmid To: Reinette Chatre , x86@kernel.org, linux-kernel@vger.kernel.org Cc: Fenghua Yu , 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: <20230525180209.19497-1-james.morse@arm.com> <20230525180209.19497-9-james.morse@arm.com> <348034b1-7bca-a8cf-b5bc-36c656de0bd3@intel.com> Content-Language: en-US In-Reply-To: <348034b1-7bca-a8cf-b5bc-36c656de0bd3@intel.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,NICE_REPLY_A, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham 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 Hi Reinette, On 6/15/23 23:09, Reinette Chatre wrote: > On 5/25/2023 11:01 AM, James Morse wrote: >> diff --git a/arch/x86/kernel/cpu/resctrl/monitor.c b/arch/x86/kernel/cpu/resctrl/monitor.c >> index 1e7fa40ee471..128d4c7206e4 100644 >> --- a/arch/x86/kernel/cpu/resctrl/monitor.c >> +++ b/arch/x86/kernel/cpu/resctrl/monitor.c >> @@ -379,6 +379,51 @@ static struct rmid_entry *resctrl_find_free_rmid(u32 closid) >> return ERR_PTR(-ENOSPC); >> } >> >> +/** >> + * resctrl_find_cleanest_closid() - Find a CLOSID where all the associated >> + * RMID are clean, or the CLOSID that has >> + * the most clean RMID. >> + * >> + * MPAM's equivalent of RMID are per-CLOSID, meaning a freshly allocated CLOSID >> + * may not be able to allocate clean RMID. To avoid this the allocator will >> + * choose the CLOSID with the most clean RMID. >> + * >> + * When the CLOSID and RMID are independent numbers, the first free CLOSID will >> + * be returned. >> + * >> + * Call when CONFIG_RESCTRL_RMID_DEPENDS_ON_CLOSID is defined. If not, call >> + * resctrl_closid_alloc_first_free() instead. > > I was not able to find where resctrl_closid_alloc_first_free() is introduced. Oops, this was the name for the other half of closid_alloc() back when I thought it was more readable to give it a name. The version posted leaves it alone to reduce the churn. I'll drop this paragraph. Thanks, James