* Con Kolivas <[email protected]> wrote:
> > - if (likely(!current->exit_state)) {
> > - if (unlikely(in_atomic())) {
> > + if (unlikely(in_atomic())) {
> > + if (likely(!current->exit_state)) {
>
> I suspect that once we're in_atomic() then we're no longer likely to
> be !current->exit_state
>
> Probably better to just
> if (unlikely(in_atomic())) {
> if (!current->exit_state) {
>
> Ingo?
yeah. There's not much point in nesting likely/unlikely. In fact we can
just merge the two conditions, as per updated patch below.
Ingo
---
From: Andreas Mohr <[email protected]>
small schedule() microoptimization.
Signed-off-by: Andreas Mohr <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
--- linux/kernel/sched.c.orig
+++ linux/kernel/sched.c
@@ -2873,13 +2873,11 @@ asmlinkage void __sched schedule(void)
* schedule() atomically, we ignore that path for now.
* Otherwise, whine if we are scheduling when we should not be.
*/
- if (likely(!current->exit_state)) {
- if (unlikely(in_atomic())) {
- printk(KERN_ERR "scheduling while atomic: "
- "%s/0x%08x/%d\n",
- current->comm, preempt_count(), current->pid);
- dump_stack();
- }
+ if (unlikely(in_atomic() && !current->exit_state)) {
+ printk(KERN_ERR "scheduling while atomic: "
+ "%s/0x%08x/%d\n",
+ current->comm, preempt_count(), current->pid);
+ dump_stack();
}
profile_hit(SCHED_PROFILING, __builtin_return_address(0));
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]