Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-18 Thread André Almeida
Hi Peter, Às 06:02 de 16/02/21, Peter Zijlstra escreveu: On Mon, Feb 15, 2021 at 12:23:52PM -0300, André Almeida wrote: +static int __futex_wait(struct futexv_head *futexv, unsigned int nr_futexes, + struct hrtimer_sleeper *timeout) +{ + int ret; + + while (1)

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-18 Thread Gabriel Krisman Bertazi
André Almeida writes: >>> + if (unlikely(ret)) { >>> + spin_unlock(>lock); >>> + >>> + bucket_dec_waiters(bucket); >>> + __set_current_state(TASK_RUNNING); >>> + *awakened = futex_dequeue_multiple(futexv, i); >>> +

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-18 Thread André Almeida
Hi Gabriel, Às 16:59 de 15/02/21, Gabriel Krisman Bertazi escreveu: André Almeida writes: +/** + * struct futexv_head - List of futexes to be waited + * @task:Task to be awaken + * @hint:Was someone on this list awakened? + * @objects: List of futexes + */ +struct futexv_head { +

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Gabriel Krisman Bertazi
Peter Zijlstra writes: > On Mon, Feb 15, 2021 at 12:23:52PM -0300, André Almeida wrote: >> Create a new set of futex syscalls known as futex2. This new interface >> is aimed to implement a more maintainable code, while removing obsolete >> features and expanding it with new functionalities. >>

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Peter Zijlstra
On Tue, Feb 16, 2021 at 11:20:44AM +0100, Sebastian Andrzej Siewior wrote: > On 2021-02-16 10:56:14 [+0100], Peter Zijlstra wrote: > > So while I'm in favour of adding a new interface, I'm not sure I see > > benefit of reimplementing the basics, sure it seems simpler now, but > > that's because

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Sebastian Andrzej Siewior
On 2021-02-16 10:56:14 [+0100], Peter Zijlstra wrote: > So while I'm in favour of adding a new interface, I'm not sure I see > benefit of reimplementing the basics, sure it seems simpler now, but > that's because you've not implemented all the 'fun' stuff. The last attempt tried to hide the

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Peter Zijlstra
On Mon, Feb 15, 2021 at 12:23:52PM -0300, André Almeida wrote: > Create a new set of futex syscalls known as futex2. This new interface > is aimed to implement a more maintainable code, while removing obsolete > features and expanding it with new functionalities. > > Implements wait and wake

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Peter Zijlstra
On Mon, Feb 15, 2021 at 12:23:52PM -0300, André Almeida wrote: > +static int futex_dequeue_multiple(struct futexv_head *futexv, unsigned int > nr) > +{ > + int i, ret = -1; > + > + for (i = 0; i < nr; i++) { > + spin_lock(>objects[i].bucket->lock); > + if

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-16 Thread Peter Zijlstra
On Mon, Feb 15, 2021 at 12:23:52PM -0300, André Almeida wrote: > +static int __futex_wait(struct futexv_head *futexv, unsigned int nr_futexes, > + struct hrtimer_sleeper *timeout) > +{ > + int ret; > + > + while (1) { > + int awakened = -1; > + Might be

Re: [RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-15 Thread Gabriel Krisman Bertazi
André Almeida writes: > Create a new set of futex syscalls known as futex2. This new interface > is aimed to implement a more maintainable code, while removing obsolete > features and expanding it with new functionalities. Hi André. Some comments below > +/* kernel/futex2.c */ > +asmlinkage

[RFC PATCH 01/13] futex2: Implement wait and wake functions

2021-02-15 Thread André Almeida
Create a new set of futex syscalls known as futex2. This new interface is aimed to implement a more maintainable code, while removing obsolete features and expanding it with new functionalities. Implements wait and wake semantics for futexes, along with the base infrastructure for future