[PATCH RFC v2 0/2] pidfs: use maple tree
Matthew Wilcox
willy at infradead.org
Fri Dec 13 10:53:55 PST 2024
On Fri, Dec 13, 2024 at 07:51:50PM +0100, Christian Brauner wrote:
> Yeah, it does. Did you see the patch that is included in the series?
> I've replaced the macro with always inline functions that select the
> lock based on the flag:
>
> static __always_inline void mtree_lock(struct maple_tree *mt)
> {
> if (mt->ma_flags & MT_FLAGS_LOCK_IRQ)
> spin_lock_irq(&mt->ma_lock);
> else
> spin_lock(&mt->ma_lock);
> }
> static __always_inline void mtree_unlock(struct maple_tree *mt)
> {
> if (mt->ma_flags & MT_FLAGS_LOCK_IRQ)
> spin_unlock_irq(&mt->ma_lock);
> else
> spin_unlock(&mt->ma_lock);
> }
>
> Does that work for you?
See the way the XArray works; we're trying to keep the two APIs as
close as possible.
The caller should use mtree_lock_irq() or mtree_lock_irqsave()
as appropriate.
More information about the maple-tree
mailing list