[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65c24c5915370_38985a294d3@iweiny-mobl.notmuch>
Date: Tue, 6 Feb 2024 07:12:25 -0800
From: Ira Weiny <ira.weiny@...el.com>
To: "Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>, "Peter
Zijlstra" <peterz@...radead.org>, Dan Williams <dan.j.williams@...el.com>,
<linux-kernel@...r.kernel.org>
CC: <linux-cxl@...r.kernel.org>, Dave Jiang <dave.jiang@...el.com>, "Jonathan
Cameron" <Jonathan.Cameron@...wei.com>, Ingo Molnar <mingo@...nel.org>,
"Fabio M. De Francesco" <fabio.maria.de.francesco@...ux.intel.com>, Ira Weiny
<ira.weiny@...el.com>
Subject: Re: [PATCH 1/2 v3] cleanup: Add cond_guard() to conditional guards
Fabio M. De Francesco 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.
>
> Cc: Dave Jiang <dave.jiang@...el.com>
> Cc: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Suggested-by: Dan Williams <dan.j.williams@...el.com>
> Suggested-by: Ira Weiny <ira.weiny@...el.com>
Thanks for the revisions!
Reviewed-by: Ira Weiny <ira.weiny@...el.com>
Powered by blists - more mailing lists