Re: [PATCHv7 5/7] kho: don't unpreserve memory during abort
From: Pratyush Yadav
Date: Fri Oct 24 2025 - 11:49:42 EST
On Fri, Oct 24 2025, Pasha Tatashin wrote:
>> If any of the kho_preserve_pages() fails, the notifier block will fail,
>> cause an abort, and eventually all memory will be unpreserved.
>
> This is a wrong behavior. Why should the memory that I preserved be
> unpreserved if there is finailziation failure or abort? reserve_mem
> should still keep memory as preserved in case KHO later will be
> finalized right? I have tested that this patch works with kho
> self-test: preserve, finalize, abort, finalize again, and the pages
> are properly preserved.
>
> KHO Test and memblock do not need to ever unpreserve pages, as they
> preserve them once during boot.
Agreed. The behaviour of reserve_mem and test_kho should be fixed, patch
3 just exposes the problem.
So, for this patch
Reviewed-by: Pratyush Yadav <pratyush@xxxxxxxxxx>
>
>> Now that there is no notifier, and thus no abort, the pages must be
>> unpreserved explicitly before returning.
>>
>> Similarly, for test_kho, kho_test_notifier() calls kho_preserve_folio()
>> and expects the abort to clean things up.
>>
>> Side note: test_kho also preserves folios from kho_test_save_data() and
>> doesn't clean them up on error, but that is a separate problem that this
>> series doesn't have to solve.
>>
>> I think patch 3/7 is the one that actually causes this problem since it
>
> I updated that patch with your suggested fix.
Thanks!
--
Regards,
Pratyush Yadav