[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240219115108.00002be2@Huawei.com>
Date: Mon, 19 Feb 2024 11:51:08 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: "Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>
CC: Peter Zijlstra <peterz@...radead.org>, Dan Williams
<dan.j.williams@...el.com>, <linux-kernel@...r.kernel.org>,
<linux-cxl@...r.kernel.org>, Ingo Molnar <mingo@...nel.org>, Dave Jiang
<dave.jiang@...el.com>, Ira Weiny <ira.weiny@...el.com>
Subject: Re: [PATCH 1/3 v5] cleanup: Add cond_guard() to conditional guards
On Sat, 17 Feb 2024 11:59:02 +0100
"Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com> wrote:
> Add cond_guard() macro to conditional guards.
>
> cond_guard() is a guard to be used with the conditional variants of locks,
> like down_read_trylock() or mutex_lock_interruptible().
>
> It takes a statement (or statement-expression) that is passed as its
> second argument. That statement (or statement-expression) is executed if
> waiting for a lock is interrupted or if a _trylock() fails in case of
> contention.
>
> Usage example:
>
> cond_guard(mutex_intr, return -EINTR, &mutex);
>
> Consistent with other usage of _guard(), locks are unlocked at the exit of
> the scope where cond_guard() is called. This macro can be called multiple
> times in the same scope.
>
> Cc: Dave Jiang <dave.jiang@...el.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Suggested-by: Dan Williams <dan.j.williams@...el.com>
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
> Suggested-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Signed-off-by: Fabio M. De Francesco <fabio.maria.de.francesco@...ux.intel.com>
Looks good.
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Powered by blists - more mailing lists