linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Adam J. Richter" <adam@yggdrasil.com>
To: riel@conectiva.com.br
Cc: linux-kernel@vger.kernel.org, torvalds@transmeta.com
Subject: Re: PATCH(?): linux-2.4.4-pre2: fork should run child first
Date: Sat, 14 Apr 2001 00:58:29 -0700	[thread overview]
Message-ID: <200104140758.AAA06084@adam.yggdrasil.com> (raw)

Rik van Riel <riel@conectiva.com.br> writes, regarding the idea
of having do_fork() give all of the parent's remaining time slice to
the newly created child:

>It could upset programs which use threads to handle
>relatively IO poor things (like, waiting on disk IO in a
>thread, like glibc does to fake async file IO).

	Good point.

[...]
>If it turns out to be beneficial to run the child first (you
>can measure this), why not leave everything the same as it is
>now but have do_fork() "switch threads" internally ?

	That is an elegant idea.  Not only would you save a few cycles by
avoiding what's left of the context switch, but, more imporantly, you
would be sure that no intervening process could be selected to run
between the parent giving up the CPU and the child running (which
could otherwise waste an additional full context swtich).  Also, you
then would not necessarily have to make the parent give up all of its
remaining time slice.  These two characteristics means that future
tweaks to the scheduler would be much less likely to accidentally
defeat running of the child first.

	As far code cleanliness goes, you get to delete a line
from do_fork ("current->need_resched = 1;"), but I think that's about
it.  You might even be able to avoid adding "current = p;" to do_fork
by having newly allocating task_struct assume the identity of the
parent and making the changes to "current", although I wonder
if anything else points to the current task or if that might
screw up any interrupts that occur during that process.

Adam J. Richter     __     ______________   4880 Stevens Creek Blvd, Suite 104
adam@yggdrasil.com     \ /                  San Jose, California 95129-1034
+1 408 261-6630         | g g d r a s i l   United States of America
fax +1 408 261-6631      "Free Software For The Rest Of Us."



	

             reply	other threads:[~2001-04-14  7:58 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-04-14  7:58 Adam J. Richter [this message]
2001-04-14  8:42 ` PATCH(?): linux-2.4.4-pre2: fork should run child first Michael O'Reilly
2001-04-14  9:00 ` Linus Torvalds
2001-04-14 15:06   ` Rik van Riel
  -- strict thread matches above, loose matches on Subject: below --
2001-04-14 16:11 Adam J. Richter
2001-04-14  2:45 Adam J. Richter
2001-04-13 23:51 Adam J. Richter
2001-04-14  1:54 ` John Fremlin
2001-04-14  2:29   ` Linus Torvalds
2001-04-14  2:51     ` Alexander Viro
2001-04-14  2:52     ` Ulrich Drepper
2001-04-13 16:28 Hubertus Franke
2001-04-12 19:45 Adam J. Richter
2001-04-12 19:15 Adam J. Richter
2001-04-12 13:44 Hubertus Franke
2001-04-12  8:55 Adam J. Richter
2001-04-12 12:38 ` Horst von Brand
2001-04-17  9:15   ` Éric Brunet
2001-04-17 14:26     ` Jesse Pollard
2001-04-17 15:32     ` Éric Brunet
2001-04-13 21:08 ` John Fremlin
2001-04-14  3:53 ` Rik van Riel
2001-04-14  4:40   ` Linus Torvalds
2001-04-14 13:35     ` Rik van Riel

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=200104140758.AAA06084@adam.yggdrasil.com \
    --to=adam@yggdrasil.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=riel@conectiva.com.br \
    --cc=torvalds@transmeta.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;
as well as URLs for NNTP newsgroup(s).