On Mon Jul 17, 2023 at 1:23 PM UTC, Haitao Huang wrote: > On Mon, 17 Jul 2023 07:45:36 -0500, Jarkko Sakkinen <jarkko@xxxxxxxxxx> > wrote: > > > On Wed Jul 12, 2023 at 11:01 PM UTC, Haitao Huang wrote: > >> From: Kristen Carlson Accardi <kristen@xxxxxxxxxxxxxxx> > >> > >> 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. The new structure will be used in a following set of patches to > >> implement SGX EPC cgroups. > >> > >> The changes to the structure needed for unreclaimable lists will be > >> added in later patches. > >> > >> Signed-off-by: Sean Christopherson <sean.j.christopherson@xxxxxxxxx> > >> Signed-off-by: Kristen Carlson Accardi <kristen@xxxxxxxxxxxxxxx> > >> Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx> > >> Cc: Sean Christopherson <seanjc@xxxxxxxxxx> > >> > >> V3: > >> Removed the helper functions and revised commit messages > >> --- > >> arch/x86/kernel/cpu/sgx/sgx.h | 17 +++++++++++++++++ > >> 1 file changed, 17 insertions(+) > >> > >> diff --git a/arch/x86/kernel/cpu/sgx/sgx.h > >> b/arch/x86/kernel/cpu/sgx/sgx.h > >> index f6e3c5810eef..77fceba73a25 100644 > >> --- a/arch/x86/kernel/cpu/sgx/sgx.h > >> +++ b/arch/x86/kernel/cpu/sgx/sgx.h > >> @@ -92,6 +92,23 @@ 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 { > >> + /* Must acquire this lock to access */ > >> + spinlock_t lock; > > > > Isn't this self-explanatory, why the inline comment? > > I got a warning from the checkpatch script complaining this lock needs > comments. OK, cool, not a big deal. BR, Jarkko