* [PATCH] signal: reorder struct sighand_struct
@ 2019-05-03 19:28 Alexey Dobriyan
2019-05-04 23:33 ` Michal Hocko
0 siblings, 1 reply; 3+ messages in thread
From: Alexey Dobriyan @ 2019-05-03 19:28 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel
struct sighand_struct::siglock field is the most used field by far,
put it first so that is can be accessed without IMM8 or IMM32 encoding
on x86_64.
Space savings (on trimmed down VM test config):
add/remove: 0/0 grow/shrink: 8/68 up/down: 49/-1147 (-1098)
Function old new delta
complete_signal 512 533 +21
do_signalfd4 335 346 +11
__cleanup_sighand 39 43 +4
unhandled_signal 49 52 +3
prepare_signal 692 695 +3
ignore_signals 37 40 +3
__tty_check_change.part 248 251 +3
ksys_unshare 780 781 +1
sighand_ctor 33 29 -4
ptrace_trap_notify 60 56 -4
sigqueue_free 98 91 -7
run_posix_cpu_timers 1389 1382 -7
proc_pid_status 2448 2441 -7
proc_pid_limits 344 337 -7
posix_cpu_timer_rearm 222 215 -7
posix_cpu_timer_get 249 242 -7
kill_pid_info_as_cred 243 236 -7
freeze_task 197 190 -7
flush_old_exec 1873 1866 -7
do_task_stat 3363 3356 -7
do_send_sig_info 98 91 -7
do_group_exit 147 140 -7
init_sighand 2088 2080 -8
do_notify_parent_cldstop 399 391 -8
signalfd_cleanup 50 41 -9
do_notify_parent 557 545 -12
__send_signal 1029 1017 -12
ptrace_stop 590 577 -13
get_signal 1576 1563 -13
__lock_task_sighand 112 99 -13
zap_pid_ns_processes 391 377 -14
update_rlimit_cpu 78 64 -14
tty_signal_session_leader 413 399 -14
tty_open_proc_set_tty 149 135 -14
tty_jobctrl_ioctl 936 922 -14
set_cpu_itimer 339 325 -14
ptrace_resume 226 212 -14
ptrace_notify 110 96 -14
proc_clear_tty 81 67 -14
posix_cpu_timer_del 229 215 -14
kernel_sigaction 156 142 -14
getrusage 977 963 -14
get_current_tty 98 84 -14
force_sigsegv 89 75 -14
force_sig_info 205 191 -14
flush_signals 83 69 -14
flush_itimer_signals 85 71 -14
do_timer_create 1120 1106 -14
do_sigpending 88 74 -14
do_signal_stop 537 523 -14
cgroup_init_fs_context 644 630 -14
call_usermodehelper_exec_async 402 388 -14
calculate_sigpending 58 44 -14
__x64_sys_timer_delete 248 234 -14
__set_current_blocked 80 66 -14
__ptrace_unlink 310 296 -14
__ptrace_detach.part 187 173 -14
send_sigqueue 362 347 -15
get_cpu_itimer 214 199 -15
signalfd_poll 175 159 -16
dequeue_signal 340 323 -17
do_getitimer 192 174 -18
release_task.part 1060 1040 -20
ptrace_peek_siginfo 408 387 -21
posix_cpu_timer_set 827 806 -21
exit_signals 437 416 -21
do_sigaction 541 520 -21
do_setitimer 485 464 -21
disassociate_ctty.part 545 517 -28
__x64_sys_rt_sigtimedwait 721 679 -42
__x64_sys_ptrace 1319 1277 -42
ptrace_request 1828 1782 -46
signalfd_read 507 459 -48
wait_consider_task 2027 1971 -56
do_coredump 3672 3616 -56
copy_process.part 6936 6871 -65
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
---
include/linux/sched/signal.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/include/linux/sched/signal.h
+++ b/include/linux/sched/signal.h
@@ -15,10 +15,10 @@
*/
struct sighand_struct {
- refcount_t count;
- struct k_sigaction action[_NSIG];
spinlock_t siglock;
+ refcount_t count;
wait_queue_head_t signalfd_wqh;
+ struct k_sigaction action[_NSIG];
};
/*
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] signal: reorder struct sighand_struct
2019-05-03 19:28 [PATCH] signal: reorder struct sighand_struct Alexey Dobriyan
@ 2019-05-04 23:33 ` Michal Hocko
2019-05-24 2:11 ` Andrew Morton
0 siblings, 1 reply; 3+ messages in thread
From: Michal Hocko @ 2019-05-04 23:33 UTC (permalink / raw)
To: Alexey Dobriyan; +Cc: akpm, linux-kernel, Oleg Nesterov
CCing Oleg.
On Fri 03-05-19 22:28:00, Alexey Dobriyan wrote:
[...]
> add/remove: 0/0 grow/shrink: 8/68 up/down: 49/-1147 (-1098)
[...]
> --- a/include/linux/sched/signal.h
> +++ b/include/linux/sched/signal.h
> @@ -15,10 +15,10 @@
> */
>
> struct sighand_struct {
> - refcount_t count;
> - struct k_sigaction action[_NSIG];
> spinlock_t siglock;
> + refcount_t count;
> wait_queue_head_t signalfd_wqh;
> + struct k_sigaction action[_NSIG];
> };
Is it possible that this would cause false sharing of the cache line
that would have performance implications now?
--
Michal Hocko
SUSE Labs
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] signal: reorder struct sighand_struct
2019-05-04 23:33 ` Michal Hocko
@ 2019-05-24 2:11 ` Andrew Morton
0 siblings, 0 replies; 3+ messages in thread
From: Andrew Morton @ 2019-05-24 2:11 UTC (permalink / raw)
To: Michal Hocko; +Cc: Alexey Dobriyan, linux-kernel, Oleg Nesterov
On Sat, 4 May 2019 19:33:02 -0400 Michal Hocko <mhocko@kernel.org> wrote:
> CCing Oleg.
>
> On Fri 03-05-19 22:28:00, Alexey Dobriyan wrote:
> [...]
> > add/remove: 0/0 grow/shrink: 8/68 up/down: 49/-1147 (-1098)
> [...]
> > --- a/include/linux/sched/signal.h
> > +++ b/include/linux/sched/signal.h
> > @@ -15,10 +15,10 @@
> > */
> >
> > struct sighand_struct {
> > - refcount_t count;
> > - struct k_sigaction action[_NSIG];
> > spinlock_t siglock;
> > + refcount_t count;
> > wait_queue_head_t signalfd_wqh;
> > + struct k_sigaction action[_NSIG];
> > };
>
> Is it possible that this would cause false sharing of the cache line
> that would have performance implications now?
Doesn't seem likely. Possible .count vs .siglock, but .count only gets
altered by fork/exec-style code, so it's pretty low bandwidth.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-05-24 2:11 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-03 19:28 [PATCH] signal: reorder struct sighand_struct Alexey Dobriyan
2019-05-04 23:33 ` Michal Hocko
2019-05-24 2:11 ` Andrew Morton
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.