[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5836260d-600d-4802-9f6a-b0bdb19ddbac@intel.com>
Date: Tue, 30 Apr 2024 10:18:05 +1200
From: "Huang, Kai" <kai.huang@...el.com>
To: Haitao Huang <haitao.huang@...ux.intel.com>, "hpa@...or.com"
<hpa@...or.com>, "tim.c.chen@...ux.intel.com" <tim.c.chen@...ux.intel.com>,
"linux-sgx@...r.kernel.org" <linux-sgx@...r.kernel.org>, "x86@...nel.org"
<x86@...nel.org>, "dave.hansen@...ux.intel.com"
<dave.hansen@...ux.intel.com>, "jarkko@...nel.org" <jarkko@...nel.org>,
"cgroups@...r.kernel.org" <cgroups@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"mkoutny@...e.com" <mkoutny@...e.com>, "tglx@...utronix.de"
<tglx@...utronix.de>, "Mehta, Sohil" <sohil.mehta@...el.com>, "tj@...nel.org"
<tj@...nel.org>, "mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de"
<bp@...en8.de>
CC: "mikko.ylinen@...ux.intel.com" <mikko.ylinen@...ux.intel.com>,
"seanjc@...gle.com" <seanjc@...gle.com>, "anakrish@...rosoft.com"
<anakrish@...rosoft.com>, "Zhang, Bo" <zhanb@...rosoft.com>,
"kristen@...ux.intel.com" <kristen@...ux.intel.com>, "yangjie@...rosoft.com"
<yangjie@...rosoft.com>, "Li, Zhiquan1" <zhiquan1.li@...el.com>,
"chrisyan@...rosoft.com" <chrisyan@...rosoft.com>
Subject: Re: [PATCH v12 12/14] x86/sgx: Turn on per-cgroup EPC reclamation
>>> /*
>>> @@ -42,7 +63,8 @@ static inline struct sgx_epc_lru_list
>>> *sgx_lru_list(struct sgx_epc_page *epc_pag
>>> */
>>> static inline bool sgx_can_reclaim(void)
>>> {
>>> - return !list_empty(&sgx_global_lru.reclaimable);
>>> + return !sgx_cgroup_lru_empty(misc_cg_root()) ||
>>> + !list_empty(&sgx_global_lru.reclaimable);
>>> }
>>
>> Shouldn't this be:
>>
>> if (IS_ENABLED(CONFIG_CGROUP_MISC))
>> return !sgx_cgroup_lru_empty(misc_cg_root());
>> else
>> return !list_empty(&sgx_global_lru.reclaimable);
>> ?
>>
>> In this way, it is consistent with the sgx_reclaim_pages_global() below.
>>
>
> I changed to this way because sgx_cgroup_lru_empty() is now defined in
> both KConfig cases.
> And it seems better to minimize use of the KConfig variables based on
> earlier feedback (some are yours).
> Don't really have strong preference here. So let me know one way of the
> other.
>
But IMHO your code could be confusing, e.g., it can be interpreted as:
The EPC pages can be managed by both the cgroup LRUs and the
sgx_global_lru simultaneously at runtime when CONFIG_CGROUP_MISC
is on.
Which is not true.
So we should make the code clearly reflect the true behaviour.
Powered by blists - more mailing lists