[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y4qBCjTcMdBLUNEB@google.com>
Date: Fri, 2 Dec 2022 22:49:46 +0000
From: Sean Christopherson <seanjc@...gle.com>
To: Dave Hansen <dave.hansen@...el.com>
Cc: Kristen Carlson Accardi <kristen@...ux.intel.com>,
jarkko@...nel.org, dave.hansen@...ux.intel.com, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-sgx@...r.kernel.org,
cgroups@...r.kernel.org, Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
x86@...nel.org, "H. Peter Anvin" <hpa@...or.com>,
zhiquan1.li@...el.com
Subject: Re: [PATCH v2 02/18] x86/sgx: Store struct sgx_encl when allocating
new VA pages
On Fri, Dec 02, 2022, Dave Hansen wrote:
> On 12/2/22 14:35, Sean Christopherson wrote:
> >> That seems like it's going the other direction from what an OOM-kill
> >> would need to do.
> > Providing a backpointer from a VA page to its enclave allows OOM-killing the enclave
> > if its cgroup is over the limit but there are no reclaimable pages for said cgroup
> > (for SGX's definition of "reclaimable"). I.e. if all of an enclave's "regular"
> > pages have been swapped out, the only thing left resident in the EPC will be the
> > enclave's VA pages, which are not reclaimable in the kernel's current SGX
> > implementation.
>
> Ooooooooooooooooooooh. I'm a dummy.
>
>
> So, we've got a cgroup. It's in OOM-kill mode and we're looking at the
> *cgroup* LRU lists. We've done everything we can to the enclave and
> swapped everything out that we can. All we're left with are these
> crummy VA pages on the LRU (or equally crummy pages). We want to
> reclaim them but can't swap VA pages. Our only recourse is to go to the
> enclave and kill *it*.
>
> Right now, we can easily find an enclave's VA pages and free them. We
> do that all the time when freeing whole enclaves. But, what we can't
> easily do is find an enclave given a VA page.
>
> A reverse pointer from VA page back to enclave allows the VA page's
> enclave to be located and efficiently killed.
>
> Right?
Yep, exactly.
Powered by blists - more mailing lists