diff: nuke a redundant check for cpu_unidle() (i386)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

diff: nuke a redundant check for cpu_unidle() (i386)

Vladimir Kirillov-2
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);
  }
 }

Reply | Threaded
Open this post in threaded view
|

Re: diff: nuke a redundant check for cpu_unidle() (i386)

Thomas de Grivel-2
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);
>   }
>   }