On Mon, Mar 01, 2021, Kai Huang wrote:
> +     /*
> +      * SECS pages are "pinned" by child pages, an unpinned once all

s/an/and

> +      * children have been EREMOVE'd.  A child page in this instance
> +      * may have pinned an SECS page encountered in an earlier release(),
> +      * creating a zombie.  Since some children were EREMOVE'd above,
> +      * try to EREMOVE all zombies in the hopes that one was unpinned.
> +      */
> +     mutex_lock(&zombie_secs_pages_lock);
> +     list_for_each_entry_safe(epc_page, tmp, &zombie_secs_pages, list) {
> +             /*
> +              * Speculatively remove the page from the list of zombies,
> +              * if the page is successfully EREMOVE it will be added to
> +              * the list of free pages.  If EREMOVE fails, throw the page
> +              * on the local list, which will be spliced on at the end.
> +              */
> +             list_del(&epc_page->list);
> +
> +             if (sgx_vepc_free_page(epc_page))
> +                     list_add_tail(&epc_page->list, &secs_pages);
> +     }
> +
> +     if (!list_empty(&secs_pages))
> +             list_splice_tail(&secs_pages, &zombie_secs_pages);
> +     mutex_unlock(&zombie_secs_pages_lock);
> +
> +     kfree(vepc);
> +
> +     return 0;
> +}

Reply via email to