[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <BL1PR11MB5978A8E4B6E1DC4CC0159FD0F77D2@BL1PR11MB5978.namprd11.prod.outlook.com>
Date: Tue, 30 Jan 2024 15:39:44 +0000
From: "Huang, Kai" <kai.huang@...el.com>
To: Haitao Huang <haitao.huang@...ux.intel.com>, "jarkko@...nel.org"
<jarkko@...nel.org>, "dave.hansen@...ux.intel.com"
<dave.hansen@...ux.intel.com>, "tj@...nel.org" <tj@...nel.org>,
"mkoutny@...e.com" <mkoutny@...e.com>, "linux-kernel@...r.kernel.org"
<linux-kernel@...r.kernel.org>, "linux-sgx@...r.kernel.org"
<linux-sgx@...r.kernel.org>, "x86@...nel.org" <x86@...nel.org>,
"cgroups@...r.kernel.org" <cgroups@...r.kernel.org>, "tglx@...utronix.de"
<tglx@...utronix.de>, "mingo@...hat.com" <mingo@...hat.com>, "bp@...en8.de"
<bp@...en8.de>, "hpa@...or.com" <hpa@...or.com>, "Mehta, Sohil"
<sohil.mehta@...el.com>
CC: "Li, Zhiquan1" <zhiquan1.li@...el.com>, "kristen@...ux.intel.com"
<kristen@...ux.intel.com>, "seanjc@...gle.com" <seanjc@...gle.com>, "Zhang,
Bo" <zhanb@...rosoft.com>, "anakrish@...rosoft.com" <anakrish@...rosoft.com>,
"mikko.ylinen@...ux.intel.com" <mikko.ylinen@...ux.intel.com>,
"yangjie@...rosoft.com" <yangjie@...rosoft.com>, "chrisyan@...rosoft.com"
<chrisyan@...rosoft.com>
Subject: RE: [PATCH v8 07/15] x86/sgx: Expose sgx_reclaim_pages() for cgroup
> + * @lru: The LRU from which pages are reclaimed.
> + * @nr_to_scan: Pointer to the target number of pages to scan, must be less
> than
> + * SGX_NR_TO_SCAN.
> + * Return: Number of pages reclaimed.
> */
> -static void sgx_reclaim_pages(void)
> +unsigned int sgx_reclaim_pages(struct sgx_epc_lru_list *lru, unsigned
> +int *nr_to_scan)
Since the function is now returning the number of reclaimed pages, why do you need to make the @nr_to_scan as pointer?
Cannot the caller just adjust @nr_to_scan when calling this function based on how many pages have reclaimed?
I am not even sure whether you need @nr_to_scan at all because as we discussed I think it's just extremely rare you need to pass "< SGX_NR_TO_SCAN" to this function.
Even if you need, you can always choose to try to reclaim SGX_NR_TO_SCAN pages.
[...]
>
> +static void sgx_reclaim_pages_global(void) {
> + unsigned int nr_to_scan = SGX_NR_TO_SCAN;
> +
> + sgx_reclaim_pages(&sgx_global_lru, &nr_to_scan); }
> +
I think this function doesn't look sane at all when you have @nr_to_scan being a pointer?
I am also not sure whether this function is needed -- if we don't add @nr_to_scan to sgx_reclaim_pages(), then this function is basically:
sgx_reclaim_pages(&sgx_global_lru);
Powered by blists - more mailing lists