> > yet for one machine conf.nmach == 4 and for the
> > other conf.nmach == 16; neither is calling halt.
> 
> Hypothesis: with four processors there's enough work to keep all
> the cpus busy.  With sixteen processors you're getting i/o bound
> (where's the filesystem coming from?) so some of the cpus are
> idling, and would call halt if they were allowed to.

it seems to be a tad more complicated than that.
these machines "aren't doing anything"; i'm the only
one logged in, and they run no services.

16cpus; >/dev/kpctl echo startclr; sleep 5;>/dev/kpctl echo stop; \
        kprof /386/9pccpu /dev/kpdata | sed 10q
total: 79782    in kernel text: 79782   outside kernel text: 0
KTZERO f0100000
ms        %     sym
60348    75.2   runproc
9125     11.3   _cycles
6230      7.7   perfticks
2696      3.3   isaconfig
1271      1.5   idlehands
1127      1.4   microdelay
1         0.0   freepte

4cpus; >/dev/kpctl echo startclr; sleep 5;>/dev/kpctl echo stop; \
        kprof /386/9pccpu /dev/kpdata | sed 10q
total: 20327    in kernel text: 20327   outside kernel text: 0
KTZERO f0100000
ms        %     sym
8124     40.2   rebalance
5261     26.0   runproc
3252     16.1   _cycles
1997      9.9   perfticks
702       3.4   microdelay
548       2.7   idlehands
349       1.7   isaconfig

this trend continues with burncycles, a program
(attached) that actually does stuff on n cpus:

4cpus; for(i in 1 2 4){
        >/dev/kpctl echo startclr;
        >/dev/null time 8.burncycles $i;
        >/dev/kpctl echo stop;
        kprof /386/9pccpu /dev/kpdata|sed 10q
}
10.56u 0.00s 10.56r      8.burncycles 1
total: 42246    in kernel text: 31684   outside kernel text: 10562
KTZERO f0100000
ms        %     sym
12693    40.0   rebalance
8324     26.2   runproc
5215     16.4   _cycles
3182     10.0   perfticks
1088      3.4   microdelay
902       2.8   idlehands
611       1.9   isaconfig
10.56u 0.00s 10.56r      8.burncycles 2
total: 42561    in kernel text: 21441   outside kernel text: 21120
KTZERO f0100000
ms        %     sym
8567     39.9   rebalance
5558     25.9   runproc
3483     16.2   _cycles
2190     10.2   perfticks
742       3.4   microdelay
590       2.7   idlehands
408       1.9   isaconfig
10.56u 0.00s 10.56r      8.burncycles 4
total: 42524    in kernel text: 428     outside kernel text: 42096
KTZERO f0100000
ms        %     sym
159      37.1   rebalance
120      28.0   runproc
63       14.7   _cycles
49       11.4   perfticks
17        3.9   idlehands
9         2.1   isaconfig
9         2.1   microdelay

8cpus; for(i in 1 2 4 8 16){
        >/dev/kpctl echo startclr;
        >/dev/null time 8.burncycles $i;
        >/dev/kpctl echo stop;
        kprof /386/9pccpu /dev/kpdata|sed 10q
}
17.26u 0.00s 17.26r      8.burncycles 1
total: 265856   in kernel text: 248594  outside kernel text: 17262
KTZERO f0100000
ms        %     sym
191427   77.0   runproc
28607    11.5   _cycles
21218     8.5   perfticks
8618      3.4   isaconfig
4408      1.7   idlehands
3584      1.4   microdelay
1         0.0   nhgets
17.64u 0.00s 17.64r      8.burncycles 2
total: 276561   in kernel text: 241360  outside kernel text: 35201
KTZERO f0100000
ms        %     sym
181186   75.0   runproc
26816    11.1   _cycles
23267     9.6   perfticks
8049      3.3   isaconfig
4261      1.7   idlehands
3483      1.4   microdelay
2         0.0   sleep
18.87u 0.00s 18.87r      8.burncycles 4
total: 297021   in kernel text: 225113  outside kernel text: 71908
KTZERO f0100000
ms        %     sym
168136   74.6   runproc
24904    11.0   _cycles
22849    10.1   perfticks
7462      3.3   isaconfig
3879      1.7   idlehands
3058      1.3   microdelay
1         0.0   ilock
18.65u 0.00s 18.65r      8.burncycles 8
total: 289838   in kernel text: 148804  outside kernel text: 141034
KTZERO f0100000
ms        %     sym
117215   78.7   runproc
16729    11.2   _cycles
12872     8.6   perfticks
5119      3.4   isaconfig
2765      1.8   idlehands
2064      1.3   microdelay
2         0.0   sleep
19.34u 0.00s 19.35r      8.burncycles 16
total: 281308   in kernel text: -9895   outside kernel text: 291203
KTZERO f0100000
ms        %     sym
497      -5.0   runproc
78        0.-7  _cycles
50        0.-5  perfticks
14        0.-1  isaconfig
10        0.-1  microdelay
8         0.0   idlehands
1         0.0   ilock

- erik
#include <u.h>
#include <libc.h>
#include <thread.h>

#define Scale   (100000000000ull)

/*
 * waste time
 */
vlong
πjj(uint j)
{
        vlong v;

        v = 4*Scale / (2*j + 1);
        if(j&1)
                return -v;
        return v;
}

vlong
π(void)
{
        uint i;
        vlong v;

        v = 0;
        for(i = 0; i < 500000000; i++)
                v += πjj(i);
        return v;
}

void
p(void *v)
{
        int i;

        i = (int)v;
        print("%d: %lld\n", i, π());
        threadexits("");
}

void
usage(void)
{
        fprint(2, "usage: burncycles nthread\n");
        threadexits("usage");
}

void
threadmain(int argc, char **argv)
{
        int n, i;

        ARGBEGIN{
        default:
                usage();
        }ARGEND
        n = 1;
        else if(argc > 1 || (n = atoi(argv[0])) <= 0)
                usage();
        for(i = 0; i < n-1; i++)
                proccreate(p, (void*)i, 4096);
        p((void*)i);
}

Reply via email to