Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Haitao Huang
On Fri, 16 Feb 2024 15:55:10 -0600, Dave Hansen wrote: On 2/16/24 13:38, Haitao Huang wrote: On Fri, 16 Feb 2024 09:15:59 -0600, Dave Hansen wrote: ... Does this 'indirect' change any behavior other than whether it does a search for an mm to find a place to charge the backing storage? N

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Dave Hansen
On 2/16/24 13:38, Haitao Huang wrote: > On Fri, 16 Feb 2024 09:15:59 -0600, Dave Hansen > wrote: ... >> Does this 'indirect' change any behavior other than whether it does a >> search for an mm to find a place to charge the backing storage? > > No. > >> Instead of passing a flag around, why not

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Haitao Huang
On Fri, 16 Feb 2024 09:15:59 -0600, Dave Hansen wrote: On 2/5/24 13:06, Haitao Huang wrote: @@ -414,7 +416,7 @@ static void sgx_reclaim_pages_global(void) void sgx_reclaim_direct(void) { if (sgx_should_reclaim(SGX_NR_LOW_PAGES)) - sgx_reclaim_pages_global(); +

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-16 Thread Dave Hansen
On 2/5/24 13:06, Haitao Huang wrote: > @@ -414,7 +416,7 @@ static void sgx_reclaim_pages_global(void) > void sgx_reclaim_direct(void) > { > if (sgx_should_reclaim(SGX_NR_LOW_PAGES)) > - sgx_reclaim_pages_global(); > + sgx_reclaim_pages_global(false); > } > > stat

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-15 Thread Haitao Huang
Hi Dave, On Thu, 15 Feb 2024 17:43:18 -0600, Dave Hansen wrote: On 2/5/24 13:06, Haitao Huang wrote: static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) { @@ -1003,14 +1001,6 @@ static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) str

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-15 Thread Dave Hansen
On 2/5/24 13:06, Haitao Huang wrote: > static struct mem_cgroup *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) > { > @@ -1003,14 +1001,6 @@ static struct mem_cgroup > *sgx_encl_get_mem_cgroup(struct sgx_encl *encl) > struct sgx_encl_mm *encl_mm; > int idx; > > - /* > - *

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-12 Thread Haitao Huang
On Mon, 12 Feb 2024 13:46:06 -0600, Jarkko Sakkinen wrote: On Mon Feb 5, 2024 at 11:06 PM EET, Haitao Huang wrote: Enclave Page Cache(EPC) memory can be swapped out to regular system "Enclave Page Cache (EPC)" ~ Will fix. [...] int sgx_encl_alloc_backing(struct sgx_e

Re: [PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-12 Thread Jarkko Sakkinen
On Mon Feb 5, 2024 at 11:06 PM EET, Haitao Huang wrote: > Enclave Page Cache(EPC) memory can be swapped out to regular system "Enclave Page Cache (EPC)" ~ > memory, and the consumed memory should be charged to a proper > mem_cgroup. Currently the selection of mem_cgroup to char

[PATCH v9 09/15] x86/sgx: Charge mem_cgroup for per-cgroup reclamation

2024-02-05 Thread Haitao Huang
Enclave Page Cache(EPC) memory can be swapped out to regular system memory, and the consumed memory should be charged to a proper mem_cgroup. Currently the selection of mem_cgroup to charge is done in sgx_encl_get_mem_cgroup(). But it only considers two contexts in which the swapping can be done: n