lkml.org 
[lkml]   [2022]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH V3 19/30] x86/sgx: Free up EPC pages directly to support large page ranges
On 4/5/22 10:13, Reinette Chatre wrote:
>>> +void sgx_direct_reclaim(void)
>>> +{
>>> + if (sgx_should_reclaim(SGX_NR_LOW_PAGES))
>>> + sgx_reclaim_pages();
>>> +}
>> Please, instead open code this to both locations - not enough redundancy
>> to be worth of new function. Causes only unnecessary cross-referencing
>> when maintaining. Otherwise, I agree with the idea.
>>
> hmmm, that means the heart of the reclaimer (sgx_reclaim_pages()) would be
> made available for direct use from everywhere in the driver. I will look into this.

I like the change. It's not about reducing code redundancy, it's about
*describing* what the code does. Each location could have:

/* Enter direct SGX reclaim: */
if (sgx_should_reclaim(SGX_NR_LOW_PAGES))
sgx_reclaim_pages();

Or, it could just be:

sgx_direct_reclaim();

Which also provides a logical choke point to add comments, like:

/*
* sgx_direct_reclaim() should be called in locations where SGX
* memory resources might be low and might be needed in order
* to make forward progress.
*/
void sgx_direct_reclaim(void)
{
...

\
 
 \ /
  Last update: 2022-04-06 02:26    [W:0.101 / U:0.044 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site