On 06/03/11 18:58, Toby Gray wrote:
> On Fri, 2011-06-03 at 18:19 +0200, Nicolas CARRIER wrote:
>> Hello !
>> I'm investigating on pppob memory and CPU consumption which seems rather
>> high when it is "doing nothing" (i.e. blocked on its select())
>> When I issue
>>       $ strace -f -p pid_of_pppob
>>
>> I see a bunch of
>>       [pid 13886] select(4, NULL, [3], NULL, {0, 1000}) = 0 (Timeout)
>>       [pid 13886] gettimeofday({1307117559, 919982}, NULL) = 0
>>       [pid 13886] ioctl(3, USBDEVFS_REAPURBNDELAY or
>> USBDEVFS_REAPURBNDELAY32, 0xf736129c) = -1 EAGAIN (Resource temporarily
>> unavailable)
>> with 13886 not being the real pid of pppob... I suspect there is a fork
>> somewhere, but this pid doesn't appears when I do a top.
>>
>> The version of barry I use is still the git version of the 5 may I
>> pulled, I will test Monday with a more recent checkout.
>> Do you have a clue of what could cause these errors ?
> I think it's something to do with how libusb 0.1 works. If I run
> brawchannel with strace -ft then I get similar output to what you see
> with pppob.
>
> The last parameter to the select call is a struct timespec which
> specifies to wait for 1000 microseconds (so 1 millisecond). This means
> that the select will trigger every millisecond, or one thousand times a
> second.
>
> Looking at the libusb 0.1 code seems to confirm this behaviour. See the
> code which calls select in usb_urb_transfer in the libusb 0.1 code:
> http://libusb.cvs.sourceforge.net/viewvc/libusb/libusb/linux.c?revision=1.83&view=markup
>
> Luckily libusb 1.0 appears to be more sensible, calling select with a
> timeout of 1 second:
> [pid  8334] 17:46:42<... select resumed>  ) = 0 (Timeout)
> [pid  8334] 17:46:42 select(1, [0], NULL, NULL, {1, 0}<unfinished ...>
> [pid  8335] 17:46:42<... poll resumed>  ) = 1 ([{fd=8, revents=POLLIN}])
> [pid  8335] 17:46:42 timerfd_settime(8, 0, {it_interval={0, 0},
> it_value={0, 0}}, NULL) = 0
> [pid  8335] 17:46:42 ioctl(9, USBDEVFS_DISCARDURB, 0x1bad320) = 0
> [pid  8335] 17:46:42 poll([{fd=6, events=POLLIN}, {fd=8, events=POLLIN},
> {fd=9, events=POLLOUT}], 3, 60000) = 1 ([{fd=9, revents=POLLOUT}])
> [pid  8335] 17:46:42 ioctl(9, USBDEVFS_REAPURBNDELAY, 0x7f8b77a13b88) =
> 0
> [pid  8335] 17:46:42 timerfd_settime(8, 0, {it_interval={0, 0},
> it_value={0, 0}}, NULL) = 0
> [pid  8335] 17:46:42 futex(0x1ba6d80, FUTEX_WAKE_PRIVATE, 1) = 0
> [pid  8335] 17:46:42 ioctl(9, USBDEVFS_SUBMITURB, 0x1bad320) = 0
> [pid  8335] 17:46:42 timerfd_settime(8, TFD_TIMER_ABSTIME,
> {it_interval={0, 0}, it_value={2345, 306889000}}, NULL) = 0
> [pid  8335] 17:46:42 poll([{fd=6, events=POLLIN}, {fd=8, events=POLLIN},
> {fd=9, events=POLLOUT}], 3, 60000<unfinished ...>
> [pid  8334] 17:46:43<... select resumed>  ) = 0 (Timeout)
>
> So if you're feeling really brave it might be interesting to see if the
> libusb 1.0 changes that are currently in my github branch help with your
> CPU usage problem. There's certainly far less output from strace when
> using libusb 1.0 compared to libusb 0.1.
>
> Regards,
>
> Toby
>
Great !
It seems to work at least on my desktop, CPU consumption dropped down a 
lot, I'm now trying to test it on my target. I'll let you know when I'll 
have more results.
Thank you for your help and your work !

Regards

-- 
Nicolas CARRIER - Parrot France


------------------------------------------------------------------------------
Simplify data backup and recovery for your virtual environment with vRanger.
Installation's a snap, and flexible recovery options mean your data is safe,
secure and there when you need it. Discover what all the cheering's about.
Get your free trial download today. 
http://p.sf.net/sfu/quest-dev2dev2 
_______________________________________________
Barry-devel mailing list
Barry-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/barry-devel

Reply via email to