Re: [RFC/RFT PATCH v3] sched: automated per tty task groups

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linus Torvalds
Date: Tuesday, October 26, 2010 - 8:47 am

On Tue, Oct 26, 2010 at 12:29 AM, Mike Galbraith <mgalbraith@suse.de> wrote:

So I have a suggestion that may not be popular with you, because it
does end up changing the approach of your patch a lot.

And I have to say, I like how your last patch looked. It was
surprisingly small, simple, and clean. So I hate saying "I think it
should perhaps do things a bit differently". That said, I would
suggest:

 - don't depend on "tsk->signal->tty" at all.

 - INSTEAD, introduce a "tsk->signal->sched_group" pointer that points
to whatever the current auto-task_group is. Remember, long-term, we'd
want to maybe have other heuristics than just the tty groups, so we'd
want this separate from the tty logic _anyway_

 - at fork time, just copy the task_group pointer in copy_signal() if
it is non-NULL, and increment the refcount (I don't think struct
task_group is refcounted now, but this would require it).

 - at free_signal_struct(), just do a
"put_task_group(sig->task_group);" before freeing it.

 - make the scheduler use the "tsk->signal->sched_group" as the
default group if nothing else exists.

Now, all the basic logic is _entirely_ unaware of any tty logic, and
it's generic. And none of it has any races with some odd tty release
logic or anything like that.

Now, after this, the only thing you'd need to do is hook into
__proc_set_tty(), which already holds the sighand lock, and _there_
you would attach the task_group to the process. Notice how it would
never be attached to a tty at all, so tty_release etc would never be
involved in any taskgroup thing - it's not really the tty that owns
the taskgroup, it's simply the act of becoming a tty task group leader
that attaches the task to a new scheduling group.

It also means, for example, that if a process loses its tty (and
doesn't get a new one - think hangup), it still remains in whatever
scheduling group it started out with. The tty really is immaterial.

And the nice thing about this is that it should be trivial to make
other things than tty's trigger this same thing, if we find a pattern
(or create some new interface to let people ask for it) for something
that should create a new group (like perhaps spawning a graphical
application from the window manager rather than from a tty).

Comments?

                                           Linus
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 2:16 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Peter Zijlstra, (Tue Oct 19, 2:26 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Peter Zijlstra, (Tue Oct 19, 2:29 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 2:39 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 2:42 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Peter Zijlstra, (Tue Oct 19, 2:43 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 2:46 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 4:29 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 6:12 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Linus Torvalds, (Tue Oct 19, 8:28 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 11:13 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 19, 11:53 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Markus Trippelsdorf, (Wed Oct 20, 6:55 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Wed Oct 20, 7:41 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 12:55 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 1:11 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 1:39 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Markus Trippelsdorf, (Thu Oct 21, 1:48 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 1:52 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Peter Zijlstra, (Thu Oct 21, 3:28 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mathieu Desnoyers, (Thu Oct 21, 3:51 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Peter Zijlstra, (Thu Oct 21, 4:25 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 4:27 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mathieu Desnoyers, (Thu Oct 21, 9:22 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Oleg Nesterov, (Thu Oct 21, 9:29 am)
Re: [RFC/RFT PATCH] sched: automated per tty task groups, Mike Galbraith, (Thu Oct 21, 12:11 pm)
[RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 26, 12:07 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Tue Oct 26, 12:29 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Oct 26, 8:47 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Thu Nov 11, 11:34 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Thu Nov 11, 12:08 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Markus Trippelsdorf, (Thu Nov 11, 12:15 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Thu Nov 11, 12:35 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Thu Nov 11, 12:37 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Markus Trippelsdorf, (Thu Nov 11, 12:38 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Thu Nov 11, 12:58 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Sun Nov 14, 10:19 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Markus Trippelsdorf, (Sun Nov 14, 10:49 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Sun Nov 14, 11:10 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Sun Nov 14, 12:28 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Markus Trippelsdorf, (Sun Nov 14, 1:27 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Valdis.Kletnieks, (Mon Nov 15, 3:41 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 10:03 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Nov 16, 10:11 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Tue Nov 16, 10:42 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 11:08 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 11:16 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 11:21 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Nov 16, 11:49 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 11:59 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 12:13 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 12:25 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Nov 16, 12:35 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Markus Trippelsdorf, (Tue Nov 16, 12:42 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Peter Zijlstra, (Tue Nov 16, 12:43 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Nov 16, 12:45 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Tue Nov 16, 12:49 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Tue Nov 16, 12:57 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:03 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:05 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:28 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:31 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:33 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:36 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 1:50 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 2:08 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 2:14 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 2:17 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 2:19 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Tue Nov 16, 5:21 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Wed Nov 17, 8:01 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Wed Nov 17, 3:34 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Wed Nov 17, 3:45 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Wed Nov 17, 4:49 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Hans-Peter Jansen, (Thu Nov 18, 3:33 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 4:12 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 4:43 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 5:02 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 5:07 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 5:42 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 5:59 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Thu Nov 18, 6:23 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mathieu Desnoyers, (Thu Nov 18, 8:15 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Fri Nov 19, 2:02 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mathieu Desnoyers, (Fri Nov 19, 5:55 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mathieu Desnoyers, (Fri Nov 19, 6:20 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Fri Nov 19, 7:24 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Fri Nov 19, 7:55 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Fri Nov 19, 9:34 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Fri Nov 19, 10:51 am)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Fri Nov 19, 12:31 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Linus Torvalds, (Fri Nov 19, 12:48 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Fri Nov 19, 6:13 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Fri Nov 19, 6:33 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Sat Nov 20, 8:41 am)
[PATCH v4] sched: automated per session task groups, Mike Galbraith, (Sat Nov 20, 12:35 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Sat Nov 20, 12:47 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Mike Galbraith, (Sat Nov 20, 12:51 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Sat Nov 20, 1:25 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Konstantin Svist, (Sat Nov 20, 3:02 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Samuel Thibault, (Sat Nov 20, 3:15 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Thomas Fjellstrom, (Sat Nov 20, 3:18 pm)
Re: [RFC/RFT PATCH v3] sched: automated per tty task groups, Lennart Poettering, (Mon Nov 22, 12:21 pm)
[tip:sched/core] sched: Add 'autogroup' scheduling feature ..., tip-bot for Mike Gal ..., (Tue Nov 30, 8:39 am)
Re: [PATCH v4] sched: automated per session task groups, Colin Walters, (Sat Dec 4, 10:39 am)
Re: [PATCH v4] sched: automated per session task groups, Linus Torvalds, (Sat Dec 4, 11:33 am)
Re: [PATCH v4] sched: automated per session task groups, Colin Walters, (Sat Dec 4, 1:01 pm)
Re: [PATCH v4] sched: automated per session task groups, Linus Torvalds, (Sat Dec 4, 3:39 pm)
Re: [PATCH v4] sched: automated per session task groups, Colin Walters, (Sat Dec 4, 4:43 pm)
Re: [PATCH v4] sched: automated per session task groups, Linus Torvalds, (Sat Dec 4, 5:31 pm)
Re: [PATCH v4] sched: automated per session task groups, Nikos Chantziaras, (Sun Dec 5, 4:11 am)
Re: [PATCH v4] sched: automated per session task groups, Mike Galbraith, (Sun Dec 5, 4:36 am)
Re: [PATCH v4] sched: automated per session task groups, Colin Walters, (Sun Dec 5, 12:22 pm)
Re: [PATCH v4] sched: automated per session task groups, Linus Torvalds, (Sun Dec 5, 1:47 pm)
Re: [PATCH v4] sched: automated per session task groups, Colin Walters, (Sun Dec 5, 3:47 pm)
Re: [PATCH v4] sched: automated per session task groups, Valdis.Kletnieks, (Sun Dec 5, 5:28 pm)
Re: [PATCH v4] sched: automated per session task groups, Peter Zijlstra, (Tue Dec 7, 11:51 am)
[tip:sched/core] sched, autogroup: Fix potential access to ..., tip-bot for Mike Gal ..., (Tue Jan 4, 7:18 am)