[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230530093452.GA153810@hirez.programming.kicks-ass.net>
Date: Tue, 30 May 2023 11:34:52 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: keescook@...omium.org, gregkh@...uxfoundation.org,
pbonzini@...hat.com, linux-kernel@...r.kernel.org,
ojeda@...nel.org, ndesaulniers@...gle.com, mingo@...hat.com,
will@...nel.org, longman@...hat.com, boqun.feng@...il.com,
juri.lelli@...hat.com, vincent.guittot@...aro.org,
dietmar.eggemann@....com, rostedt@...dmis.org, bsegall@...gle.com,
mgorman@...e.de, bristot@...hat.com, vschneid@...hat.com,
paulmck@...nel.org, frederic@...nel.org, quic_neeraju@...cinc.com,
joel@...lfernandes.org, josh@...htriplett.org,
mathieu.desnoyers@...icios.com, jiangshanlai@...il.com,
rcu@...r.kernel.org, tj@...nel.org, tglx@...utronix.de
Subject: Re: [PATCH v2 0/2] Lock and Pointer guards
On Tue, May 30, 2023 at 11:23:42AM +0200, Peter Zijlstra wrote:
> Yes, it's a wee bit more involved, but I'm thinking it gives a fair
> amount of flexibility and we don't need to ret rid of
> -Wdeclaration-after-statement.
One other thing I forgot to point put; it allows things like:
int store_fd(int fd)
{
ptr_guard(fdput, f) = fdget(fd);
void *ret;
if (!f.file)
return -EBADF;
ret = xa_store(&xarray, f.file->private, f);
if (xa_is_err(ret))
return xa_err(ret);
f = null_ptr(fdput); // xarray now owns f
return 0;
}
Where we can assign null_ptr() to clear the guard and inhibit the
cleanup function to pass ownership around.
Powered by blists - more mailing lists