Re: [PATCH v5 08/18] x86/sgx: Use a list to track to-be-reclaimed pages

From: Haitao Huang
Date: Tue Oct 03 2023 - 01:09:55 EST


On Thu, 28 Sep 2023 04:28:34 -0500, Huang, Kai <kai.huang@xxxxxxxxx> wrote:

On Fri, 2023-09-22 at 20:06 -0700, Haitao Huang wrote:
@@ -314,18 +313,22 @@ static void sgx_reclaim_pages(void)
if (kref_get_unless_zero(&encl_page->encl->refcount) != 0) {
sgx_epc_page_set_state(epc_page, SGX_EPC_PAGE_RECLAIM_IN_PROGRESS);
- chunk[cnt++] = epc_page;
+ list_move_tail(&epc_page->list, &iso);
} else {
- /* The owner is freeing the page. No need to add the
- * page back to the list of reclaimable pages.
+ /* The owner is freeing the page, remove it from the
+ * LRU list
*/

Please fix comment style.

Sure


sgx_epc_page_reset_state(epc_page);
+ list_del_init(&epc_page->list);

Is this still needed? It seems list_del_init() has been done when the EPC page
is taken off from the global active list?


Good catch. I'll remove it.

Thanks
Haitao