Re: [PATCH v16 09/16] x86/sgx: Add basic EPC reclamation flow for cgroup

From: Haitao Huang
Date: Thu Aug 22 2024 - 00:01:15 EST


+static struct sgx_cgroup *sgx_cgroup_next_descendant_pre(struct sgx_cgroup *root,
+ struct sgx_cgroup *cg)
+{
+ struct cgroup_subsys_state *next;
+
+ rcu_read_lock();
+ for (;;) {
+ next = css_next_descendant_pre(&cg->cg->css, &root->cg->css);

I messed it up in a last minute change and rebase. Above should be:

+ struct cgroup_subsys_state *next = &cg->cg->css;
+
+ rcu_read_lock();
+ for (;;) {
+ next = css_next_descendant_pre(next, &root->cg->css);

Fixed in a branch here: https://github.com/haitaohuang/linux/tree/sgx_cg_upstream_v16_plus
Will include in next version or update if needed.

+ if (!next) {
+ next = &root->cg->css;
+ break;
+ }
+
+ if (css_tryget(next))
+ break;
+ }
+ rcu_read_unlock();
+
+ return sgx_cgroup_from_misc_cg(css_misc(next));
+}
+
BR
Haitao