Skip to content

Commit 69995eb

Browse files
KAGA-KOKOPeter Zijlstra
authored andcommitted
signal: Hand SIGQUEUE_PREALLOC flag to __sigqueue_alloc()
There is no point in having the conditional at the callsite. Just hand in the allocation mode flag to __sigqueue_alloc() and use it to initialize sigqueue::flags. No functional change. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Peter Zijlstra (Intel) <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent 4aed8aa commit 69995eb

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

kernel/signal.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,8 @@ void task_join_group_stop(struct task_struct *task)
410410
* appropriate lock must be held to stop the target task from exiting
411411
*/
412412
static struct sigqueue *
413-
__sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimit)
413+
__sigqueue_alloc(int sig, struct task_struct *t, gfp_t gfp_flags,
414+
int override_rlimit, const unsigned int sigqueue_flags)
414415
{
415416
struct sigqueue *q = NULL;
416417
struct user_struct *user;
@@ -432,7 +433,7 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi
432433
rcu_read_unlock();
433434

434435
if (override_rlimit || likely(sigpending <= task_rlimit(t, RLIMIT_SIGPENDING))) {
435-
q = kmem_cache_alloc(sigqueue_cachep, flags);
436+
q = kmem_cache_alloc(sigqueue_cachep, gfp_flags);
436437
} else {
437438
print_dropped_signal(sig);
438439
}
@@ -442,7 +443,7 @@ __sigqueue_alloc(int sig, struct task_struct *t, gfp_t flags, int override_rlimi
442443
free_uid(user);
443444
} else {
444445
INIT_LIST_HEAD(&q->list);
445-
q->flags = 0;
446+
q->flags = sigqueue_flags;
446447
q->user = user;
447448
}
448449

@@ -1113,7 +1114,8 @@ static int __send_signal(int sig, struct kernel_siginfo *info, struct task_struc
11131114
else
11141115
override_rlimit = 0;
11151116

1116-
q = __sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit);
1117+
q = __sigqueue_alloc(sig, t, GFP_ATOMIC, override_rlimit, 0);
1118+
11171119
if (q) {
11181120
list_add_tail(&q->list, &pending->list);
11191121
switch ((unsigned long) info) {
@@ -1807,12 +1809,7 @@ EXPORT_SYMBOL(kill_pid);
18071809
*/
18081810
struct sigqueue *sigqueue_alloc(void)
18091811
{
1810-
struct sigqueue *q = __sigqueue_alloc(-1, current, GFP_KERNEL, 0);
1811-
1812-
if (q)
1813-
q->flags |= SIGQUEUE_PREALLOC;
1814-
1815-
return q;
1812+
return __sigqueue_alloc(-1, current, GFP_KERNEL, 0, SIGQUEUE_PREALLOC);
18161813
}
18171814

18181815
void sigqueue_free(struct sigqueue *q)

0 commit comments

Comments
 (0)