> When collapse_file encounters dirty or writeback pages in file-backed
> mappings, it currently returns SCAN_FAIL which maps to -EINVAL. This is
> misleading as EINVAL suggests invalid arguments, whereas dirty/writeback
> pages represent transient conditions that may resolve on retry.
> 
> Introduce SCAN_PAGE_DIRTY_OR_WRITEBACK to cover both dirty and writeback
> states, mapping it to -EAGAIN. For MADV_COLLAPSE, this provides userspace
> with a clear signal that retry may succeed after writeback completes.
> For khugepaged, this is harmless as it will naturally revisit the range
> during periodic scans after async writeback completes.
> 
> Reported-by: Branden Moore <[email protected]>
> Closes: 
> https://lore.kernel.org/all/[email protected]
> Fixes: 34488399fa08 ("mm/madvise: add file and shmem support to 
> MADV_COLLAPSE")
> Reviewed-by: Dev Jain <[email protected]>
> Reviewed-by: Lance Yang <[email protected]>
> Signed-off-by: Shivank Garg <[email protected]>
> ---

LGTM.
Reviewed-by: wang lian <[email protected]>
--
Best Regards,
wang lian

Reply via email to