linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
To: linux-hotplug@vger.kernel.org
Subject: Revisiting threaded udevd
Date: Mon, 22 Dec 2008 11:25:54 +0000	[thread overview]
Message-ID: <494F7942.6060702@tuffmail.co.uk> (raw)

I have some time to look at this again now.

I think Scott was right to question the way I handled running external
programs.  The "udev-exec" daemon takes a fair amount of code, and it's
not easy to justify.  I also suspect it would have bad effects on
process placement on many-cpu systems.

That said, "udev-exec" does actually improve performance.  I would
explain this as fork() being more efficient in processes with a smaller
memory map.  A multi-threaded udevd requires additional address space
for each thread stack.

So I'm going to try limiting the number of threads.  E.g. a maximum of 2
+ 2N running threads.  "Running" is defined as "not waiting for an
external program".  The current limit on total threads would still be
applied.   The hope is to reduce the number of threads, while still
allowing lots of parallel IO.  Reducing the number of threads should
help reduce overheads in general.

The second reason for "udev-exec" was the "close on exec" problem of
leaking irrelevant file descriptors to helper programs.  Scott suggests
that I make udev depend on the latest system calls, e.g. pipe2(), in
2.6.27.  But I want to be able to run older kernels for testing etc!  So
I'll take advantage of the new calls where available.  On older kernels,
I'll use an RW lock to make e.g.

pipe();
fcntl(fd, F_SETFD, FD_CLOEXEC)

atomic against fork().


For completeness, the last reason for udev-exec was more convenient
timeouts.  Without udev-exec I expect they'll be a bit clunky, but it
can be done.

Regards
Alan

             reply	other threads:[~2008-12-22 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-22 11:25 Alan Jenkins [this message]
2008-12-24 11:37 ` Revisiting threaded udevd Scott James Remnant
2008-12-25 17:36 ` Alan Jenkins
2008-12-27 10:29 ` Scott James Remnant
2008-12-27 19:07 ` Alan Jenkins

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=494F7942.6060702@tuffmail.co.uk \
    --to=alan-jenkins@tuffmail.co.uk \
    --cc=linux-hotplug@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).