Re: [PATCH v4 18/18] mm: factor out can_spin_trylock()
From: Harry Yoo
Date: Fri Jul 03 2026 - 05:39:12 EST
On 7/2/26 6:49 PM, Brendan Jackman wrote:
> Deduplicate checks for whether the current context is safe for
> spin_trylock().
>
> Does this function really belong in mm/internal.h or is it generic? Not
> sure. If someone ends up duplicating this logic elsewhere in the kernel,
> that would be a shame.
Wondering what BPF has been doing about it...
> But goes in some generic header, someone treats
> it as documentation about where it's guaranteed safe to spin_trylock(),
> and then it emerges that there are other subtle preconditions that
> didn't affect the mm usecase, that would be worse. So, just be
> conservative and keep it local.
But yeah, agreed.
> Suggested-by: Harry Yoo <harry@xxxxxxxxxx>
> Link: https://lore.kernel.org/all/397859cb-b127-4cc6-9c71-044afc99bf0c@xxxxxxxxxx/
> Signed-off-by: Brendan Jackman <jackmanb@xxxxxxxxxx>
> ---
Reviewed-by: Harry Yoo (Oracle) <harry@xxxxxxxxxx>
Thanks!
--
Cheers,
Harry / Hyeonggon
Attachment:
OpenPGP_signature.asc
Description: OpenPGP digital signature