[Toybox] [PATCH] killall should kill scripts too.

enh enh at google.com
Wed Dec 20 10:34:08 PST 2017


On Tue, Dec 19, 2017 at 2:35 PM, Rob Landley <rob at landley.net> wrote:
>
>
> On 12/18/2017 11:15 PM, enh wrote:
>> On Mon, Dec 18, 2017 at 5:07 PM, enh <enh at google.com> wrote:
>>>> Having killall need to do similar grinding over a large number of
>>>> processes seems unnecessary. That said, it looks like to match ubuntu's
>>>> killall we would need to read two files _and_ stat /proc/$$/exe.
>>>
>>> that's still a lot lighter weight than all the work pgrep/pkill have
>>> to do, and it's what everyone's already living with anyway...
>>
>> (and toybox lsof is still 10x faster than FSF lsof on my machines.
>
> $ sleep 999 > test3 &
> $ time lsof test3
> COMMAND   PID    USER   FD   TYPE DEVICE SIZE/OFF     NODE NAME
> sleep   31117 landley    1w   REG    8,1        0 11944128 test3
>
> real    0m3.134s
> user    0m0.988s
> sys     0m2.084s
> $ time ./lsof ../toy3/test3
> COMMAND     PID       USER   FD      TYPE             DEVICE  SIZE/OFF
>     NODE NAME
> sleep     31117    landley    1w      REG                8,1         0
> 11944128 /home/landley/toybox/toy3/test3
>
> real    0m3.279s
> user    0m1.032s
> sys     0m2.000s
>
> $ ps ax |wc
>     376    3041   98906
>
> Same 3 seconds to iterate over 376 processes in the simple case. (lsof
> -i takes 6 seconds, toybox doesn't have -i yet...)

i think we have this same conversation every few months :-)

we should probably work out what's different. maybe because my
machines have lots of processes and few network connections?
(profiling confirms that most of lsof time goes to parsing
/proc/PID/maps for me.)

>> don't think lsof is high on the list of things to worry about. even
>> for top, i'm more worried about the fact that it crashes if you leave
>> it running long enough, or the broken ps -AT...)
>
> I have a tab open for ps -AT, but I thought I'd gotten all the ps/top
> crashes out of the way? Is that still a thing?

i think the ps "directory disappeared from under me" crashes are
fixed. i haven't seen a report for some time.

i don't think the top "memory corruption if left running long enough"
crashes are fixed, but i've only ever seen a few crashes. i've just
built a ToT toybox with asan for my laptop and i'll leave it running
during the day.

> Rob



-- 
Elliott Hughes - http://who/enh - http://jessies.org/~enh/
Android native code/tools questions? Mail me/drop by/add me as a reviewer.



More information about the Toybox mailing list