Re: [PATCH] mm/zblock: use vmalloc for page allocations

From: Sergey Senozhatsky
Date: Thu May 08 2025 - 02:18:36 EST


On (25/05/07 23:00), Christoph Hellwig wrote:
> On Thu, May 08, 2025 at 02:58:14PM +0900, Sergey Senozhatsky wrote:
> > Oh, I didn't realize that zram was the only swap_slot_free_notify
> > user. zram already handles REQ_OP_DISCARD/REQ_OP_WRITE_ZEROES so
> > I guess only swap-cluster needs some work. Are there any
> > blockers/complications on the swap-cluster side?
>
> I think the reason it was added it was so that the discard can be
> done non-blocking with a spinlock held. Which seems a bit sketch
> when calling into a driver anyway..

swap_slot_free_notify is not guaranteed to free anything on the zram/zsmalloc
side. zram attempts to trylock entry and if it fails to acquire the ownership
swap_slot_free_notify for that entry becomes a .miss_free. So we just keep
stale data in zspage (potentially, preventing it from being released if that
was the last allocated object). I don't know if .miss_free happens often in
real life.