Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1629595
| From | Peter Zijlstra <peterz@infradead.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic |
| Date | 2017-04-24 16:00 +0200 |
| Message-ID | <tzMGZ-7IC-9@gated-at.bofh.it> (permalink) |
| References | <tyTrc-5zp-11@gated-at.bofh.it> <tzI0G-4Nd-19@gated-at.bofh.it> <tzLBg-72B-21@gated-at.bofh.it> <tzLKW-75O-5@gated-at.bofh.it> <tzMdZ-7wX-41@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Mon, Apr 24, 2017 at 09:28:36AM -0400, Steven Rostedt wrote:
> > static inline bool rto_start_trylock(atomic_t *v)
> > {
> > int zero = 0;
> > return atomic_try_cmpxchg(v, &zero, 1);
>
> To keep the same semantics of spin_trylock(), should we:
try_cmpxchg returns the success of the "cmp" part. So if the above
returns true, the "cmp" part was a success and we did the "xchg" part,
so we now own the lock.
That's right, no?
> return !atomic_cmpxchg(v, &zero, 1);
>
> as the old value of zero means we got it.
The same, but results in an extra compare instruction to compare the
result, instead of using the one cmpxchg already did.
> BTW, I don't see any atomic_try_cmpxchg().
a9ebf306f52c ("locking/atomic: Introduce atomic_try_cmpxchg()")
Should be in tip someplace.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-22 05:00 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-22 20:50 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Peter Zijlstra <peterz@infradead.org> - 2017-04-24 11:00 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-24 14:50 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-24 14:50 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Peter Zijlstra <peterz@infradead.org> - 2017-04-24 15:00 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-24 15:30 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Peter Zijlstra <peterz@infradead.org> - 2017-04-24 16:00 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Peter Zijlstra <peterz@infradead.org> - 2017-04-24 11:00 +0200
Re: [RFC][PATCH tip/sched/core] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-24 14:50 +0200
[PATCH RT v2] sched/rt: Simplify the IPI rt balancing logic Steven Rostedt <rostedt@goodmis.org> - 2017-04-24 18:00 +0200
csiph-web