IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Initializing a char array to "" is equivalent to a memset()
call - which is exactly what it gets compiled to.
Fixing this one callsite reduced memset() _user_ cpu cycles
from 2-4% to 0.05% on the EeePC.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
This crops up in my threaded udevd profiles from time to time.
It's not consistent - probably due to variations in the number
of concurrent events - but it can hit 4% user time and higher.
The change halves the user time spent in compare_devpath().
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
The wait should be ordered after matching KERNEL, ENV, etc.
but before ATTR.
Without this, WAIT_FOR_SYSFS rules will be applied unconditionally
to all events.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Re: b99028c963 shrink struct udev_event
TEST 136: test multi matches 2
device '/devices/pci0000:00/0000:00:1d.7/usb5/5-2/5-2:1.0/tty/ttyACM0' expecting node 'right'
==15011==
==15011== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==15011== at 0x47F9AB8: malloc (vg_replace_malloc.c:207)
==15011== by 0x489CB5F: strdup (in /lib32/libc-2.7.so)
==15011== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973)
==15011== by 0x804A658: udev_event_execute_rules (udev-event.c:549)
==15011== by 0x805A636: main (test-udev.c:100)
add: ok
==15012==
==15012== 7 bytes in 1 blocks are definitely lost in loss record 1 of 1
==15012== at 0x47F1AB8: malloc (vg_replace_malloc.c:207)
==15012== by 0x4898B5F: strdup (in /lib32/libc-2.7.so)
==15012== by 0x8050F40: udev_rules_apply_to_event (udev-rules.c:1973)
==15012== by 0x804A9DF: udev_event_execute_rules (udev-event.c:658)
==15012== by 0x805A636: main (test-udev.c:100)
remove: ok
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
The in-memory rule array of a common desktop distro install took:
1151088 bytes
with the token list:
109232 bytes tokens (6827 * 16 bytes), 71302 bytes buffer
The problem was strncpy() doesn't stop after writing the terminating
NUL; by definition it goes on to zero the entire buffer.
I spy another use of strncpy in udev_device_add_property_from_string(),
which is responsible for another ~1% user cpu time...
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Since we already know the length, use memcpy() instead.
Measured 2% _user_ cpu time reduction on EeePC coldplug.
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Use calloc to request cleared memory instead.
Kernel and libc conspire to make this more efficient.
Also, replace one malloc() + strcpy() with strdup().
Signed-off-by: Alan Jenkins <alan-jenkins@tuffmail.co.uk>