> +static inline bool sgx_can_reclaim_global(void)
> +{
> +     /*
> +      * Now all EPC pages are still tracked in the @sgx_global_lru, so only
> +      * check @sgx_global_lru.
> +      *
> +      * When EPC pages are tracked in the actual per-cgroup LRUs,
> +      * replace with sgx_cgroup_lru_empty(misc_cg_root()).
> +      */
> +     return !list_empty(&sgx_global_lru.reclaimable);
> +}

Firstly, sgx_cgroup_lru_empty() is only introduced in the next patch, so it's
wrong to mention it in the comment in _this_ patch.

It's weird to add the above comment here in this patch anyway, since ...

[...]


> +static void sgx_reclaim_pages_global(void)
> +{
> +     sgx_reclaim_pages(&sgx_global_lru);
>  }

... this function (which is no difference IMHO) doesn't have a similar comment
here.

The similar comment to this function is only added in the later "[PATCH v16
12/16] x86/sgx: Revise global reclamation for EPC cgroups":

 static void sgx_reclaim_pages_global(struct mm_struct *charge_mm)
 {
+       /*
+        * Now all EPC pages are still tracked in the @sgx_global_lru.
+        * Still reclaim from it.
+        *
+        * When EPC pages are tracked in the actual per-cgroup LRUs,
+        * sgx_cgroup_reclaim_pages_global() will be called.
+        */
        sgx_reclaim_pages(&sgx_global_lru, charge_mm);
 }

So if the comment of sgx_can_reclaim_global() were needed, it's more
reasonable to add it in the later patch where the comment for
sgx_reclaim_pages_global() is also added IMHO?


Reply via email to