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 54DEBC63703 for ; Thu, 8 Dec 2022 15:33:32 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230421AbiLHPda (ORCPT ); Thu, 8 Dec 2022 10:33:30 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230413AbiLHPdH (ORCPT ); Thu, 8 Dec 2022 10:33:07 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DFB90AD98F; Thu, 8 Dec 2022 07:31:45 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 6A4CE61F81; Thu, 8 Dec 2022 15:31:45 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 776C4C433C1; Thu, 8 Dec 2022 15:31:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1670513504; bh=WZTPhqweYb/o6ohDAJocfkA2T1w/HsjxsO2NnvlkgdU=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=kscGXX+bagLK+Geq93D1CijqPItQ/7f7ftpfSh/tZtfprhKu5Q2x0/FeeQuT7yuac j8wTZVA47CE//1Xy7LszG7CNWIXF4LrXf3GUUfQ021xIK5P2m56u9aXHuel30JK+lU rJBOrA/6o1BN8bqjjMtDEZ+BPC+M/2r2DCYLTOACAugpWB6CcKO+AQS4CJUmDX5FOv 0+rGZv3NADk+PapxLVsWnEFWTp1fZvf6Lyt3Czf9sYo6A0ARdrDVY/TM5KZSZ733E/ UYG1/FXw5pUGZzTt6n23kKFkpHEsUjeDI5c1Vau7JU6QqTBwYwGwiVNFev4a7/RvzR NIh65xjOZciPA== Date: Thu, 8 Dec 2022 15:31:40 +0000 From: Jarkko Sakkinen To: Kristen Carlson Accardi Cc: dave.hansen@linux.intel.com, tj@kernel.org, linux-kernel@vger.kernel.org, linux-sgx@vger.kernel.org, cgroups@vger.kernel.org, Thomas Gleixner , Ingo Molnar , Borislav Petkov , x86@kernel.org, "H. Peter Anvin" , zhiquan1.li@intel.com, Sean Christopherson Subject: Re: [PATCH v2 03/18] x86/sgx: Add 'struct sgx_epc_lru_lists' to encapsulate lru list(s) Message-ID: References: <20221202183655.3767674-1-kristen@linux.intel.com> <20221202183655.3767674-4-kristen@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20221202183655.3767674-4-kristen@linux.intel.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 02, 2022 at 10:36:39AM -0800, Kristen Carlson Accardi wrote: > Introduce a data structure to wrap the existing reclaimable list > and its spinlock in a struct to minimize the code changes needed > to handle multiple LRUs as well as reclaimable and non-reclaimable > lists, both of which will be introduced and used by SGX EPC cgroups. > > Signed-off-by: Sean Christopherson > Signed-off-by: Kristen Carlson Accardi > Cc: Sean Christopherson > --- > arch/x86/kernel/cpu/sgx/sgx.h | 65 +++++++++++++++++++++++++++++++++++ > 1 file changed, 65 insertions(+) > > diff --git a/arch/x86/kernel/cpu/sgx/sgx.h b/arch/x86/kernel/cpu/sgx/sgx.h > index 39cb15a8abcb..5e6d88438fae 100644 > --- a/arch/x86/kernel/cpu/sgx/sgx.h > +++ b/arch/x86/kernel/cpu/sgx/sgx.h > @@ -90,6 +90,71 @@ static inline void *sgx_get_epc_virt_addr(struct sgx_epc_page *page) > return section->virt_addr + index * PAGE_SIZE; > } > > +/* > + * This data structure wraps a list of reclaimable EPC pages, and a list of > + * non-reclaimable EPC pages and is used to implement a LRU policy during > + * reclamation. > + */ > +struct sgx_epc_lru_lists { > + spinlock_t lock; > + struct list_head reclaimable; > + struct list_head unreclaimable; > +}; Why this is named like this, and not sgx_epc_global_rcu? Are there any other use cases? BR, Jarkko