OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
Re: diff: nuke a redundant check for cpu_unidle() (i386)

From: Thomas de Grivel (billitchgmail.com)
Date: Wed Sep 29 2010 - 08:23:52 CDT


First: double checking is far from bad,
second: a test is much faster than a function call.

On 09/28/10 13:40, Vladimir Kirillov wrote:
> Hello, tech!
>
> Subj, cpu_unidle() does that check itself.
>
> Index: i386/machdep.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/i386/i386/machdep.c,v
> retrieving revision 1.481
> diff -u -p -r1.481 machdep.c
> --- i386/machdep.c 5 Aug 2010 21:10:09 -0000 1.481
> +++ i386/machdep.c 28 Sep 2010 11:39:14 -0000
> -3303,8 +3303,7 need_resched(struct cpu_info *ci)
> /* There's a risk we'll be called before the idle threads start */
> if (ci->ci_curproc) {
> aston(ci->ci_curproc);
> - if (ci != curcpu())
> - cpu_unidle(ci);
> + cpu_unidle(ci);
> }
> }