From: Kirill Tkhai <ktkhai@virtuozzo.com>
To: linux-kernel@vger.kernel.org, gregkh@linuxfoundation.org,
jslaby@suse.com, viro@zeniv.linux.org.uk, keescook@chromium.org,
serge@hallyn.com, james.l.morris@oracle.com, luto@kernel.org,
john.johansen@canonical.com, oleg@redhat.com, mingo@kernel.org,
akpm@linux-foundation.org, mhocko@suse.com, peterz@infradead.org,
ktkhai@virtuozzo.com
Subject: [PATCH 0/4] fs, tty: Make __do_SAK() less greedy in regard to tasklist_lock
Date: Thu, 11 Jan 2018 18:49:52 +0300 [thread overview]
Message-ID: <151568564127.6090.3546718160925256054.stgit@localhost.localdomain> (raw)
Hi,
this patchset makes __do_SAK() to take tasklist_lock for very small time
in comparison to that it does now. Though this function is executed
in process context and it takes tasklist_lock read locked with interrupts enabled,
another tasks may want to take it for writing with interrupt disabled
(e.g., forking tasks), and these tasks may evoke hard lockups.
I've observed several hard lockups caused by long execution of __do_SAK()
on the node with 200 big containers. 3.10 kernel is used there, and mainline
kernel does not have differences in comparation to that, because of __do_SAK()
function has not changed for a long time. So, mainline kernel has this problem too.
The patchset proposes two optimizations in __do__SAK(). The first one is
to skip threads, when process's open files are being analyzed (see [3/4]).
We have to check thread's files only to close the race with unshare_files()
and failing exec. This can be fixed via small modifications of unshare_files().
See [1-2/4] for the details.
The second optimization is to iterate task list under rcu_read_lock().
This allows to take tasklist_lock for a very small time just to check we
reached the end of the task list. See patch [4/4] for the details.
Thanks,
Kirill
---
Kirill Tkhai (4):
exec: Pass unshared files_struct to load_binary()
exec: Assign unshared files after there is no way back
tty: Iterate only thread group leaders in __do_SAK()
tty: Use RCU read lock to iterate tasks in __do_SAK()
drivers/tty/tty_io.c | 34 +++++++++++++++++++++++++---------
fs/binfmt_misc.c | 8 ++++----
fs/coredump.c | 9 +++++----
fs/exec.c | 14 ++++++++------
fs/file.c | 4 +++-
include/linux/binfmts.h | 1 +
include/linux/fdtable.h | 4 ++--
kernel/fork.c | 19 +++++++------------
8 files changed, 55 insertions(+), 38 deletions(-)
--
Signed-off-by: Kirill Tkhai <ktkhai@virtuozzo.com>
next reply other threads:[~2018-01-11 15:52 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-11 15:49 Kirill Tkhai [this message]
2018-01-11 15:50 ` [PATCH 1/4] exec: Pass unshared files_struct to load_binary() Kirill Tkhai
2018-01-11 15:50 ` [PATCH 2/4] exec: Assign unshared files after there is no way back Kirill Tkhai
2018-01-11 15:50 ` [PATCH 3/4] tty: Iterate only thread group leaders in __do_SAK() Kirill Tkhai
2018-01-11 18:34 ` Oleg Nesterov
2018-01-12 8:42 ` Kirill Tkhai
2018-01-12 10:05 ` Kirill Tkhai
2018-01-12 16:42 ` Oleg Nesterov
2018-01-15 9:32 ` Kirill Tkhai
2018-01-15 20:51 ` Oleg Nesterov
2018-01-16 11:33 ` Kirill Tkhai
2018-01-16 21:13 ` Oleg Nesterov
2018-01-17 12:47 ` Kirill Tkhai
2018-01-11 15:50 ` [PATCH 4/4] tty: Use RCU read lock to iterate tasks " Kirill Tkhai
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=151568564127.6090.3546718160925256054.stgit@localhost.localdomain \
--to=ktkhai@virtuozzo.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.l.morris@oracle.com \
--cc=john.johansen@canonical.com \
--cc=jslaby@suse.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mhocko@suse.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=serge@hallyn.com \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.