Re: [PATCH v3 2/2] s390/mm: re-enable the shared zeropage for !PV and !skeys KVM guests

From: David Hildenbrand
Date: Tue Apr 16 2024 - 03:05:31 EST


On 16.04.24 08:37, Alexander Gordeev wrote:
On Mon, Apr 15, 2024 at 09:14:03PM +0200, David Hildenbrand wrote:
+retry:
+ rc = walk_page_range_vma(vma, addr, vma->vm_end,
+ &find_zeropage_ops, &addr);
+ if (rc <= 0)
+ continue;

So in case an error is returned for the last vma, __s390_unshare_zeropage()
finishes with that error. By contrast, the error for a non-last vma would
be ignored?

Right, it looks a bit off. walk_page_range_vma() shouldn't fail
unless find_zeropage_pte_entry() would fail -- which would also be
very unexpected.

To handle it cleanly in case we would ever get a weird zeropage where we
don't expect it, we should probably just exit early.

Something like the following (not compiled, addressing the comment below):

@@ -2618,7 +2618,8 @@ static int __s390_unshare_zeropages(struct mm_struct *mm)
struct vm_area_struct *vma;
VMA_ITERATOR(vmi, mm, 0);
unsigned long addr;
- int rc;
+ vm_fault_t rc;
+ int zero_page;

I would use "fault" for mm faults (just like everywhere else handle_mm_fault() is
called) and leave rc as is:

vm_fault_t fault;
int rc;

Sure, let me know once discussion here stopped whether you want a v4 or can fix that up.

--
Cheers,

David / dhildenb