add pause to nix portable code to marginally improve power consumption and performance in the case of mp contention, on platforms supporting pause. Reference: /n/atom/patch/applied2013/nixpause Date: Sun Aug 25 19:23:14 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/nix/port/taslock.c Sun Aug 25 19:22:19 2013 +++ /sys/src/nix/port/taslock.c Sun Aug 25 19:22:19 2013 @@ -159,6 +159,7 @@ i = 0; lockloop(l, pc); } + pause(); } if(up) ainc(&up->nlocks); @@ -202,7 +203,7 @@ lockstats.inglare++; splx(pl); while(l->key) - ; + pause(); pl = splhi(); if(TAS(&l->key) == 0){ if(l != &waitstatslk) @@ -320,7 +321,7 @@ portmwait(void *value) { while (*(void**)value == nil) - ; + pause(); } void (*mwait)(void *) = portmwait; --- /sys/src/nix/port/sysproc.c Sun Aug 25 19:22:21 2013 +++ /sys/src/nix/port/sysproc.c Sun Aug 25 19:22:22 2013 @@ -848,7 +848,7 @@ p->rendval = PTR2UINT(va_arg(list, void*)); while(p->mach != 0) - ; + pause(); ready(p); unlock(up->rgrp);