Linkage is added for jails for the iterator to use, but it is only utilized when there are no children jails at given level, for simplicity.
This largely sorts out excessive process traversals when running poudriere, which does "kill -9 -1" in jails for each package.
Sample stats below:
processes iterated over:
> value ------------- Distribution ------------- count
> 512 | 0
> 520 | 1
> 528 | 5
> 536 | 14
> 544 |@ 26
> 552 |@ 39
> 560 |@ 31
> 568 |@ 39
> 576 |@ 41
> 584 |@ 39
> 592 |@ 37
> 600 |@ 30
> 608 | 14
> 616 | 12
> 624 | 8
> 632 | 9
> 640 | 17
> 648 | 21
> 656 |@ 36
> 664 |@ 59
> 672 |@ 52
> 680 |@@ 82
> 688 |@ 69
> 696 |@@ 96
> 704 |@@ 103
> 712 |@@ 89
> 720 |@@ 111
> 728 |@@ 93
> 736 |@@ 105
> 744 |@@ 90
> 752 |@@ 90
> 760 |@@ 94
> 768 |@ 50
> 776 |@ 56
> 784 |@ 45
> 792 |@ 33
> 800 |@ 29
> 808 | 22
> 816 | 17
> 824 | 17
> 832 | 18
> 840 | 12
> 848 | 13
> 856 | 10
> 864 | 20
> 872 | 14
> 880 | 24
> 888 | 12
> 896 | 5
> 904 | 6
> 912 | 4
> 920 | 2
> 928 | 3
> 936 | 1
> 944 | 2
> 952 | 2
> 960 | 0
> 968 | 3
> 976 | 2
> 984 | 3
> 992 | 2
> 1000 | 0
> 1008 | 3
> 1016 | 1
> >= 1024 | 0
>
processes signalled:
> value ------------- Distribution ------------- count
> -1 | 0
> 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1983
> 1 | 0
>
Note this patch does not fully solve the problem outlined by me in D28566 -- should something want to kill everything in the jail without paying for entering it, there is still no way to do it.with the patch:
> value ------------- Distribution ------------- count
> 0 | 0
> 1 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1454
> 2 | 0
>
>
> value ------------- Distribution ------------- count
> -1 | 0
> 0 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1454
> 1 | 0
Note this patch does not fully solve the problem outlined by me in D28566 -- should something want to kill everything in the jail without paying for entering it, there is still no way to do it.