linux-rt-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Brian Silverman <brian@peloton-tech.com>
To: linux-kernel@vger.kernel.org
Cc: linux-rt-users@vger.kernel.org, bigeasy@linutronix.de,
	Brian Silverman <brian@peloton-tech.com>
Subject: [PATCH] Force processes to non-realtime before mm_exit
Date: Fri,  3 Jun 2016 16:18:44 -0700	[thread overview]
Message-ID: <1464995924-16367-1-git-send-email-brian@peloton-tech.com> (raw)

Without this, a realtime process which has called mlockall exiting
causes large latencies for other realtime processes at the same or
lower priorities. This seems like a fairly common use case too, because
realtime processes generally want their memory locked into RAM.

Signed-off-by: Brian Silverman <brian@peloton-tech.com>
---
 kernel/exit.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/kernel/exit.c b/kernel/exit.c
index a0cf72b..68a97df 100644
--- a/kernel/exit.c
+++ b/kernel/exit.c
@@ -730,6 +730,12 @@ void do_exit(long code)
 	tsk->exit_code = code;
 	taskstats_exit(tsk, group_dead);
 
+	if (tsk->policy == SCHED_FIFO || tsk->policy == SCHED_RR) {
+		struct sched_param param = { .sched_priority = 0 };
+
+		sched_setscheduler_nocheck(current, SCHED_NORMAL, &param);
+	}
+
 	exit_mm(tsk);
 
 	if (group_dead)
-- 
2.1.4

             reply	other threads:[~2016-06-03 23:18 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-03 23:18 Brian Silverman [this message]
2016-06-05  0:28 ` [PATCH] Force processes to non-realtime before mm_exit Corey Minyard
2016-07-14 17:24 ` Peter Zijlstra
2016-09-02 15:02   ` Thomas Gleixner
  -- strict thread matches above, loose matches on Subject: below --
2016-05-10 18:04 Brian Silverman
2016-05-12  8:59 ` Sebastian Andrzej Siewior
2016-05-16 21:05   ` Brian Silverman
2016-05-25 16:33     ` Sebastian Andrzej Siewior
2016-05-25 18:00       ` Brian Silverman
2016-05-25 19:54         ` Sebastian Andrzej Siewior
2016-06-03 23:33           ` Brian Silverman

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=1464995924-16367-1-git-send-email-brian@peloton-tech.com \
    --to=brian@peloton-tech.com \
    --cc=bigeasy@linutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rt-users@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).