Re: [PATCH 1/2] cleanup: Add conditional guard support

From: Oleg Nesterov
Date: Thu Nov 02 2023 - 10:42:08 EST


On 11/02, Peter Zijlstra wrote:
>
> include/linux/cleanup.h | 52 ++++++++++++++++++++++++++++++++++++++++++++---

interesting... I don't know anything about cleanup.h, will
read this code and the patch later, but I guess I understand
the idea.

Stupid/offtopic question... Can't we change guard()

-#define guard(_name) \
- CLASS(_name, __UNIQUE_ID(guard))
+#define guard(_name, args...) \
+ CLASS(_name, __UNIQUE_ID(guard))(args)

and update the current users?

To me

guard(rcu);
guard(spinlock, &lock);

looks better than

guard(rcu)();
// doesn't match scoped_guard(spinlock, &lock)
guard(spinlock)(&lock);

And this will make guard() consistent with scoped_guard().

No?

Oleg.