diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-09-03 17:30:04 +0000 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2022-09-03 17:30:04 +0000 |
commit | 3e115487969570445a58a5a351a7bf0e0ab5fc21 (patch) | |
tree | 98d03736051c50aee5b5b59250f35000532a8fd8 /sys/src/9/port/devproc.c | |
parent | 99529b80a3bbe35c5cd5dadf5f106632a2449e84 (diff) |
kernel: half NERR, refcount Note's to avoid excessive allocations for postnotepg()
Half NERR stack to 32.
When posing a note to a large group, avoid allocating Notes
for each individual process, but post the reference instread.
factor out process interruption into procinterrupt().
Avoid allocation of notes in alarmkproc, just posting the
same note to everyone.
Diffstat (limited to 'sys/src/9/port/devproc.c')
-rw-r--r-- | sys/src/9/port/devproc.c | 32 |
1 files changed, 11 insertions, 21 deletions
diff --git a/sys/src/9/port/devproc.c b/sys/src/9/port/devproc.c index 0d4ae5193..8c0f93454 100644 --- a/sys/src/9/port/devproc.c +++ b/sys/src/9/port/devproc.c @@ -351,24 +351,6 @@ changenoteid(Proc *p, ulong noteid) error(Eperm); } -static void -postnotepg(ulong noteid, char *n, int flag) -{ - Proc *p; - int i; - - for(i = 0; (p = proctab(i)) != nil; i++){ - if(p == up) - continue; - if(p->noteid != noteid || p->kp) - continue; - qlock(&p->debug); - if(p->noteid == noteid) - postnote(p, 0, n, flag); - qunlock(&p->debug); - } -} - static void clearwatchpt(Proc *p); static Chan* @@ -1421,6 +1403,12 @@ parsetime(vlong *rt, char *s) static void procctlreq(Proc *p, char *va, int n) { + static Note killnote = { + "sys: killed", + NExit, + 1, + }; + Segment *s; uintptr npc; int pri; @@ -1455,12 +1443,14 @@ procctlreq(Proc *p, char *va, int n) break; case Stopped: p->procctl = Proc_exitme; - postnote(p, 0, "sys: killed", NExit); + incref(&killnote); + pushnote(p, &killnote); ready(p); break; default: p->procctl = Proc_exitme; - postnote(p, 0, "sys: killed", NExit); + incref(&killnote); + pushnote(p, &killnote); } break; case CMnohang: @@ -1542,7 +1532,7 @@ procctlreq(Proc *p, char *va, int n) } break; case CMinterrupt: - postnote(p, 0, nil, NUser); + procinterrupt(p); break; case CMnointerrupt: if(p->nnote == 0) |