On Sun, 14 Aug 2022 14:36:29 -0500, Jarkko Sakkinen <jarkko@xxxxxxxxxx>
wrote:
On Fri, Aug 12, 2022 at 12:12:24PM -0700, Haitao Huang wrote:
Return VM_FAULT_NOPAGE to allow the swapping thread to catch up.
link:
https://lore.kernel.org/all/20220804201456.33418-1-vijay.dhanraj@xxxxxxxxx/
Signed-off-by: Haitao Huang <haitao.huang@xxxxxxxxxxxxxxx>
---
arch/x86/kernel/cpu/sgx/encl.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/arch/x86/kernel/cpu/sgx/encl.c
b/arch/x86/kernel/cpu/sgx/encl.c
index 24c1bb8eb196..1f88f80c4477 100644
--- a/arch/x86/kernel/cpu/sgx/encl.c
+++ b/arch/x86/kernel/cpu/sgx/encl.c
@@ -344,8 +344,11 @@ static vm_fault_t sgx_encl_eaug_page(struct
vm_area_struct *vma,
}
va_page = sgx_encl_grow(encl, false);
- if (IS_ERR(va_page))
- goto err_out_epc;
+ if (IS_ERR(va_page)) {
+ if (PTR_ERR(va_page) == -EBUSY)
+ vmret = VM_FAULT_NOPAGE;
+ goto err_out_epc;
+ }
if (va_page)
list_add(&va_page->list, &encl->va_pages);
--
2.25.1
Indentation is probably not right, but the fix look legit.
Fixed in updated patch. Can I add your "Reviewed-by" tag?
Thanks
Haitao