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

From: Thomas Gleixner
Date: Thu Mar 04 2021 - 16:15:41 EST


On Wed, Mar 03 2021 at 16:37, Oleg Nesterov wrote:
> On 03/03, Sebastian Andrzej Siewior wrote:
>> +static void __sigqueue_cache_or_free(struct sigqueue *q)
>> +{
>> + struct user_struct *up;
>> +
>> + if (q->flags & SIGQUEUE_PREALLOC)
>> + return;
>> +
>> + up = q->user;
>> + if (atomic_dec_and_test(&up->sigpending))
>> + free_uid(up);
>> + if (!task_is_realtime(current) || !sigqueue_add_cache(current, q))
>> + kmem_cache_free(sigqueue_cachep, q);
>> +}
>
> Well, this duplicates __sigqueue_free... Do we really need the new helper?
> What if we simply change __sigqueue_free() to do sigqueue_add_cache() if
> task_is_realtime() && !PF_EXITING ? This too can simplify the patch...

Need to stare at all callers of __sigqueue_free() whether they are
really happy about this. Even if not, this surely can be deduplicated.

Thanks,

tglx