mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Oleg Nesterov <oleg@tv-sign.ru>
To: Satoru Takeuchi <takeuchi_satoru@jp.fujitsu.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Mike Galbraith <efault@gmx.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG] scheduler: first timeslice of the exiting thread
Date: Mon, 9 Apr 2007 15:03:33 +0400	[thread overview]
Message-ID: <20070409110333.GA253@tv-sign.ru> (raw)
In-Reply-To: <20070409102922.GA216@tv-sign.ru>

On 04/09, Oleg Nesterov wrote:
>
> Satoru Takeuchi wrote:
> >
> >   a) On sched_fork, the creator share its timeslice with new process.
> >   b) On sched_exit, if the exiting process didn't exhaust its first
> >      timeslice yet, it gives its timeslice to the parent.
> >
> > It has no problem on the process model since the creator is the parent.
> > However, on the thread model, the creator is not the parent, it is same
> > as the creator's parent. Hence, on this kind of program, the creator
> > can't retrieve shared timeslice and exausts its timeslice at a rate of
> > knots. In addition, somehow, the parent (typically shell?) gets extra
> > timeslice.
> 
> Yes, this is an old oddity.

Perhaps

	void sched_exit(struct task_struct *p)
	{
		task_t *t, *did_fork = p->parent;

		if (!thread_group_leader(p))
			list_for_each_entry(t, p->thread_group)
				if (!t->exit_state) {
					did_fork = t;
					break;
				}

		... give time_slice to did_fork ..
	}

may improve things a little bit, because the rest of time_slice doesn't leak
off the thread group.

However this is not very nice and we have the same problem with CLONE_PARENT.

Oleg.


  reply	other threads:[~2007-04-09 11:03 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-04-09 10:29 Oleg Nesterov
2007-04-09 11:03 ` Oleg Nesterov [this message]
2007-04-10  1:19 ` Satoru Takeuchi
  -- strict thread matches above, loose matches on Subject: below --
2007-04-07  7:31 Satoru Takeuchi
2007-04-07  7:45 ` Satoru Takeuchi
2007-04-09  6:09 ` Andrew Morton
2007-04-09  6:50   ` Mike Galbraith
2007-04-10  7:18     ` Satoru Takeuchi
2007-04-13 15:31   ` Con Kolivas

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=20070409110333.GA253@tv-sign.ru \
    --to=oleg@tv-sign.ru \
    --cc=akpm@linux-foundation.org \
    --cc=efault@gmx.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=takeuchi_satoru@jp.fujitsu.com \
    /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

Powered by JetHome