M port/portdat.h => port/portdat.h +1 -0
@@ 132,6 132,7 @@ struct Block
uchar* wp; /* first empty byte */
uchar* lim; /* 1 past the end of the buffer */
uchar* base; /* start of the buffer */
+ void (*free)(Block*);
ulong flag;
};
#define BLEN(s) ((s)->wp - (s)->rp)
M port/proc.c => port/proc.c +3 -2
@@ 216,9 216,10 @@ loop:
* processor can run given affinity constraints
*/
for(rq = &runq[Nrq-1]; rq >= runq; rq--){
- if(rq->head == 0)
+ p = rq->head;
+ if(p == 0)
continue;
- for(p = rq->head; p; p = p->rnext){
+ for(; p; p = p->rnext){
if(p->mp == m || m->ticks - p->movetime > HZ/2)
goto found;
}
M port/qio.c => port/qio.c +8 -0
@@ 109,6 109,14 @@ iallocb(int size)
void
freeb(Block *b)
{
+ /*
+ * drivers which perform non cache coherent DMA manage their
+ * own buffer pools, so they provide their own free routines.
+ */
+ if(b->free) {
+ b->free(b);
+ return;
+ }
if(b->flag & BINTR) {
ilock(&ialloc);
ialloc.bytes -= b->lim - b->base;