Re: [PATCH] signal: Allow RT tasks to cache one sigqueue struct

From: Thomas Gleixner
Date: Wed Mar 10 2021 - 03:58:29 EST


On Tue, Mar 09 2021 at 13:01, Thomas Gleixner wrote:
> On Fri, Mar 05 2021 at 11:57, Oleg Nesterov wrote:
>> On 03/04, Thomas Gleixner wrote:
>>> On Wed, Mar 03 2021 at 16:37, Oleg Nesterov wrote:
>>> >> +static bool sigqueue_add_cache(struct task_struct *t, struct sigqueue *q)
>>> >> +{
>>> >> + if (!t->sigqueue_cache && cmpxchg(&t->sigqueue_cache, NULL, q) == NULL)
>>> >> + return true;
>>> >> + return false;
>>> >> +}
>>> >
>>> > Do we really need cmpxchg? It seems they are always called with
>>> > spinlock held.
>>>
>>> With which spinlock held?
>>>
>>> __send_signal() <- sighand::siglock held
>>> __sigqueue_alloc()
>>>
>>> alloc_posix_timer()
>>> sigqueue_alloc() <- No lock held
>>> __sigqueue_alloc()
>>
>> In the last case "fromslab" is true, sigqueue_from_cache() won't be called.
>>
>>> and on the free side we have a bunch of callers which do not hold
>>> sighand::siglock either.
>>
>> Where?

Bah. I confused myself. Let me start over with that.

Thanks,

tglx