* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
@ 2008-10-23 19:03 ` Kay Sievers
2008-10-23 19:12 ` Kay Sievers
` (7 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2008-10-23 19:03 UTC (permalink / raw)
To: linux-hotplug
On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> 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.
Ah, nice! Thanks for finding that out. I do not have any of theses
rules left, as there are currently no know issues with recent kernels.
:) Applied.
Kay
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
2008-10-23 19:03 ` Kay Sievers
@ 2008-10-23 19:12 ` Kay Sievers
2008-10-23 19:56 ` Alan Jenkins
` (6 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2008-10-23 19:12 UTC (permalink / raw)
To: linux-hotplug
On Thu, Oct 23, 2008 at 21:03, Kay Sievers <kay.sievers@vrfy.org> wrote:
> On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>> 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.
>
> Ah, nice! Thanks for finding that out. I do not have any of theses
> rules left, as there are currently no know issues with recent kernels.
> :) Applied.
Oh, now that I expect it works for you without the long delay. :) How
does is compare? Is it still slower?
Thanks,
Kay
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
2008-10-23 19:03 ` Kay Sievers
2008-10-23 19:12 ` Kay Sievers
@ 2008-10-23 19:56 ` Alan Jenkins
2008-10-25 13:33 ` Kay Sievers
` (5 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alan Jenkins @ 2008-10-23 19:56 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On Thu, Oct 23, 2008 at 21:03, Kay Sievers <kay.sievers@vrfy.org> wrote:
>
>> On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>
>>> 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.
>>>
>> Ah, nice! Thanks for finding that out. I do not have any of theses
>> rules left, as there are currently no know issues with recent kernels.
>> :) Applied.
>>
>
> Oh, now that I expect it works for you without the long delay. :) How
> does is compare? Is it still slower?
>
> Thanks,
> Kay
>
No, that fixed it. The network interface rename problem seems to have
gone as well (!).
I just tested it on my desktop. oprofile says it now _reduces_ cpu
cycles in udevd by 10%. Not big enough to show up in time(1), but not
bad! And it should help more on the EeePC, which has a less lavish cpu
cache.
Alan
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (2 preceding siblings ...)
2008-10-23 19:56 ` Alan Jenkins
@ 2008-10-25 13:33 ` Kay Sievers
2008-10-25 16:19 ` Alan Jenkins
` (4 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2008-10-25 13:33 UTC (permalink / raw)
To: linux-hotplug
On Thu, Oct 23, 2008 at 21:56, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> Kay Sievers wrote:
>> On Thu, Oct 23, 2008 at 21:03, Kay Sievers <kay.sievers@vrfy.org> wrote:
>>> On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>>
>>>> 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.
>>>>
>>> Ah, nice! Thanks for finding that out. I do not have any of theses
>>> rules left, as there are currently no know issues with recent kernels.
>>> :) Applied.
>>
>> Oh, now that I expect it works for you without the long delay. :) How
>> does is compare? Is it still slower?
> No, that fixed it. The network interface rename problem seems to have
> gone as well (!).
>
> I just tested it on my desktop. oprofile says it now _reduces_ cpu
> cycles in udevd by 10%. Not big enough to show up in time(1), but not
> bad! And it should help more on the EeePC, which has a less lavish cpu
> cache.
Sounds good. I've changed a few other things, which might make things faster:
We cache the results of getpwnam/getgrnam() during rules parse time,
some of the rules files I have here have ~700 rules with GROUP="..."
keys ...
We check at parse time, if we need to call fnmatch() for a key, or can
just go with the much cheaper strcmp(). That seems to make a real
difference with the large rules files I have.
Also the snprintf() that was used compose the buffer to pass the event
to a socket was _very_ expensive. We just use strlcpy() now and cache
the result for the next RUN+="socket:" call.
Thanks,
Kay
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (3 preceding siblings ...)
2008-10-25 13:33 ` Kay Sievers
@ 2008-10-25 16:19 ` Alan Jenkins
2008-10-25 17:19 ` Alan Jenkins
` (3 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alan Jenkins @ 2008-10-25 16:19 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On Thu, Oct 23, 2008 at 21:56, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>
>> Kay Sievers wrote:
>>
>>> On Thu, Oct 23, 2008 at 21:03, Kay Sievers <kay.sievers@vrfy.org> wrote:
>>>
>>>> On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>>>
>>>>
>>>>> 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.
>>>>>
>>>>>
>>>> Ah, nice! Thanks for finding that out. I do not have any of theses
>>>> rules left, as there are currently no know issues with recent kernels.
>>>> :) Applied.
>>>>
>>> Oh, now that I expect it works for you without the long delay. :) How
>>> does is compare? Is it still slower?
>>>
>
>
>> No, that fixed it. The network interface rename problem seems to have
>> gone as well (!).
>>
>> I just tested it on my desktop. oprofile says it now _reduces_ cpu
>> cycles in udevd by 10%. Not big enough to show up in time(1), but not
>> bad! And it should help more on the EeePC, which has a less lavish cpu
>> cache.
>>
>
> Sounds good. I've changed a few other things, which might make things faster:
>
> We cache the results of getpwnam/getgrnam() during rules parse time,
> some of the rules files I have here have ~700 rules with GROUP="..."
> keys ...
>
> We check at parse time, if we need to call fnmatch() for a key, or can
> just go with the much cheaper strcmp(). That seems to make a real
> difference with the large rules files I have.
>
Nice.
> Also the snprintf() that was used compose the buffer to pass the event
> to a socket was _very_ expensive. We just use strlcpy() now and cache
> the result for the next RUN+="socket:" call.
>
I might adapt that for udev-exec.
But I think it needs a flag like envp_uptodate, no?
Regards
Alan
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (4 preceding siblings ...)
2008-10-25 16:19 ` Alan Jenkins
@ 2008-10-25 17:19 ` Alan Jenkins
2008-10-25 17:46 ` Kay Sievers
` (2 subsequent siblings)
8 siblings, 0 replies; 10+ messages in thread
From: Alan Jenkins @ 2008-10-25 17:19 UTC (permalink / raw)
To: linux-hotplug
Alan Jenkins wrote:
> Kay Sievers wrote:
>
>> On Thu, Oct 23, 2008 at 21:56, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>
>>
>>> Kay Sievers wrote:
>>>
>>>
>>>> On Thu, Oct 23, 2008 at 21:03, Kay Sievers <kay.sievers@vrfy.org> wrote:
>>>>
>>>>
>>>>> On Thu, Oct 23, 2008 at 20:37, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>>>>>
>>>>>
>>>>>
>>>>>> 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.
>>>>>>
>>>>>>
>>>>>>
>>>>> Ah, nice! Thanks for finding that out. I do not have any of theses
>>>>> rules left, as there are currently no know issues with recent kernels.
>>>>> :) Applied.
>>>>>
>>>>>
>>>> Oh, now that I expect it works for you without the long delay. :) How
>>>> does is compare? Is it still slower?
>>>>
>>>>
>>
>>
>>> No, that fixed it. The network interface rename problem seems to have
>>> gone as well (!).
>>>
>>> I just tested it on my desktop. oprofile says it now _reduces_ cpu
>>> cycles in udevd by 10%. Not big enough to show up in time(1), but not
>>> bad! And it should help more on the EeePC, which has a less lavish cpu
>>> cache.
>>>
>>>
>> Sounds good. I've changed a few other things, which might make things faster:
>>
>> We cache the results of getpwnam/getgrnam() during rules parse time,
>> some of the rules files I have here have ~700 rules with GROUP="..."
>> keys ...
>>
>> We check at parse time, if we need to call fnmatch() for a key, or can
>> just go with the much cheaper strcmp(). That seems to make a real
>> difference with the large rules files I have.
>>
>>
>
> Nice.
>
>
>> Also the snprintf() that was used compose the buffer to pass the event
>> to a socket was _very_ expensive. We just use strlcpy() now and cache
>> the result for the next RUN+="socket:" call.
>>
>>
>
> I might adapt that for udev-exec.
>
> But I think it needs a flag like envp_uptodate, no?
>
And for bonus points...
udev_device_get_properties_envp() could return pointers into this
buffer, instead of allocating individual strings on the heap.
Alan
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (5 preceding siblings ...)
2008-10-25 17:19 ` Alan Jenkins
@ 2008-10-25 17:46 ` Kay Sievers
2008-10-25 17:48 ` Kay Sievers
2008-10-25 17:57 ` Alan Jenkins
8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2008-10-25 17:46 UTC (permalink / raw)
To: linux-hotplug
On Sat, Oct 25, 2008 at 18:19, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> Kay Sievers wrote:
>> Also the snprintf() that was used compose the buffer to pass the event
>> to a socket was _very_ expensive. We just use strlcpy() now and cache
>> the result for the next RUN+="socket:" call.
>
> I might adapt that for udev-exec.
>
> But I think it needs a flag like envp_uptodate, no?
It uses monitor_buf_len, which is reset to 0, if a property gets
changed. Is that what you mean?
Kay
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (6 preceding siblings ...)
2008-10-25 17:46 ` Kay Sievers
@ 2008-10-25 17:48 ` Kay Sievers
2008-10-25 17:57 ` Alan Jenkins
8 siblings, 0 replies; 10+ messages in thread
From: Kay Sievers @ 2008-10-25 17:48 UTC (permalink / raw)
To: linux-hotplug
On Sat, Oct 25, 2008 at 19:19, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
> Alan Jenkins wrote:
>> Kay Sievers wrote:
> And for bonus points...
>
> udev_device_get_properties_envp() could return pointers into this
> buffer, instead of allocating individual strings on the heap.
Yeah, we can do this, sounds like a nice idea, to compose the buffer
and envp at the same time. Will look into it next, if you don't beat
me. :)
Kay
^ permalink raw reply [flat|nested] 10+ messages in thread* Re: [PATCH] udevd: fix WAIT_FOR_SYSFS
2008-10-23 18:37 [PATCH] udevd: fix WAIT_FOR_SYSFS Alan Jenkins
` (7 preceding siblings ...)
2008-10-25 17:48 ` Kay Sievers
@ 2008-10-25 17:57 ` Alan Jenkins
8 siblings, 0 replies; 10+ messages in thread
From: Alan Jenkins @ 2008-10-25 17:57 UTC (permalink / raw)
To: linux-hotplug
Kay Sievers wrote:
> On Sat, Oct 25, 2008 at 18:19, Alan Jenkins <alan-jenkins@tuffmail.co.uk> wrote:
>
>> Kay Sievers wrote:
>>
>
>
>>> Also the snprintf() that was used compose the buffer to pass the event
>>> to a socket was _very_ expensive. We just use strlcpy() now and cache
>>> the result for the next RUN+="socket:" call.
>>>
>> I might adapt that for udev-exec.
>>
>> But I think it needs a flag like envp_uptodate, no?
>>
>
> It uses monitor_buf_len, which is reset to 0, if a property gets
> changed. Is that what you mean?
>
> Kay
>
Sneaky. Yes, that's what I was looking for.
^ permalink raw reply [flat|nested] 10+ messages in thread