1
0
mirror of https://github.com/systemd/systemd.git synced 2024-11-02 19:21:53 +03:00
Commit Graph

22 Commits

Author SHA1 Message Date
Kay Sievers
9f894a3391 udevadm: settle - make --timeout=0 working 2009-05-21 23:49:53 +02:00
Alan Jenkins
f503f6b22f udevd: implement a more efficient queue file format
Directory lookups show up in profiling. The queue files are responsible
for a large proportion of file-related system calls in udev coldplug.

Instead of creating a file for each event, append their details to a
log file.  The file is periodically rebuilt (garbage-collected) to
prevent it from growing indefinitely.

This single queue file replaces both the queue directory and the
uevent_seqnum file. On desktop systems the file tends not to grow
beyond one page. So it should also save a small amount of memory in
tmpfs.

Tests on a running EeePC indicate average savings of 5% *udevd* cpu time
as measured by oprofile. __link_path_walk is reduced from 1.5% to
1.3%. It is not completely clear where the rest of the gains come from.

In tests running ~400 events, the queue file is rebuilt about 5 times.

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-05-21 22:22:37 +02:00
Alan Jenkins
f58a9099bb udevadm: settle - fix timeout
The timeout wasn't working when settle was run as root:
  # udevadm control --stop-exec-queue
  # udevadm trigger
  # udevadm settle --timeout=1
  ... (hangs)

Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
2009-05-20 16:12:22 +02:00
Kay Sievers
619b97ff2b remove asmlinkage 2009-05-05 02:39:16 +02:00
Scott James Remnant
bb38678e3c udevadm: settle - synchronise with the udev daemon
There's still a slight race condition when using udevadm settle, if the
udev daemon has a pending inotify event but hasn't yet generated the
"change" uevent for it, the kernel and udev sequence numbers will match
and settle will exit.

Now udevadm settle will send a control message to udevd, which will
respond by sending SIGUSR1 back to the waiting udevadm settle once it
has completed the main loop iteration in which it received the control
message.

If there were no pending inotify events, this will simply wake up the
udev daemon and allow settle to continue.  If there are pending inotify
events, they are handled first in the main loop so when settle is
continued they will have been turned into uevents and the kernel
sequence number will have been incremented.

Since the inotify event is pending for udevd when the close() system
call returns (it's queued as part of the kernel handling for that system
call), and since the kernel sequence number is incremented by writing to
the uevent file (as udevd does), this solves the race.

When the settle continues, if there were pending inotify events that
udevd had not read, they are now pending uevents which settle can wait
for.

Signed-off-by: Scott James Remnant <scott@ubuntu.com>
2009-03-12 10:02:37 +00:00
Kay Sievers
c2c24d4d3c udevadm: settle - use timeout signal, instead of loop counter 2009-03-11 15:06:14 +01:00
Kay Sievers
f1e7e36046 udevadm: add text for new options to command and man page 2009-03-07 02:32:40 +01:00
Kay Sievers
98d3d51715 udevadm: settle - add --seq-start= --seq-end=
It might be useful in some cases not to wait for "all" events.

  $ read START < /sys/kernel/uevent_seqnum
  $ (do something which may create uevents)
  $ udevadm settle --seq-start=$START
2009-03-04 23:48:53 +01:00
Kay Sievers
a402404fb2 test: add test for empty and non-existent ATTR 2009-02-05 12:40:15 +01:00
Kay Sievers
c2de781ef0 udevadm: settle - fix typo 2009-01-23 02:19:12 +01:00
Kay Sievers
b76ad2e537 udevadm: settle - allow --timeout=0 and --quiet 2008-12-08 16:48:54 +01:00
Kay Sievers
f6bb9e981a fix uninitialized variable warnings 2008-10-24 09:37:37 +02:00
Kay Sievers
033e9f8cde use no_argument, required_argument, optional_argument in longopts 2008-10-02 16:49:05 +02:00
Kay Sievers
8249e04e3e udevadm: settle - use libudev queue 2008-10-01 09:42:03 +02:00
Kay Sievers
17fcfb5972 use size definitions from libudev 2008-09-10 21:50:21 +02:00
Kay Sievers
31c1f53745 get rid of udev_sysdeps.c 2008-09-10 18:59:42 +02:00
Kay Sievers
55e9959b15 update file headers 2008-09-10 02:40:42 +02:00
Kay Sievers
d59f11e140 move udev_ctrl to libudev-private 2008-09-08 17:59:00 +02:00
Kay Sievers
7d563a17f3 use libudev code, unify logging, pass udev context around everywhere 2008-09-06 15:45:31 +02:00
Kay Sievers
60865f33a1 udevadm: move init from commands to udevadm 2008-09-04 10:34:48 +02:00
Kay Sievers
32bf83996b udevadm: rename internal functions to udevadm_* 2008-09-03 23:38:32 +02:00
Kay Sievers
e4255f1153 udevadm: rename source files 2008-09-03 23:33:06 +02:00