lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  PHC 
Open Source and information security mailing list archives
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Sun, 3 Jul 2011 14:07:21 +0600
From:	Rakib Mullick <>
To:	Peter Zijlstra <>
Cc:	Ingo Molnar <>,
	linux-kernel <>,
	Paul Turner <>
Subject: Re: [PATCH] sched: Check nr_running before calling pick_next_task in schedule().

On Sat, Jul 2, 2011 at 9:35 PM, Peter Zijlstra <> wrote:
> On Sat, 2011-07-02 at 20:26 +0600, Rakib Mullick wrote:
>> Well, yes - branching seems definitely have some side effects.
> It adds the cost of the test as well as a possible branch mis-predict.
>> Thinking from UP's perspective, it will only hit slow path -- going
>> into idle.
> Uhm, no, every time the machine is busy and does a schedule between
> tasks you still get to do that extra nr_running test and branch.
Ok, for now I'm putting branch aside. I don't think checking
nr_running isn't extra, it should be norm. Cause, if this rq has no
nr_running it calls idle_balance, at that point due to idle_balance -
we might have moved task from other rq if idle_balance is successful.
But, idle_balance might not be successful that's why I was thinking
about checking nr_running is necessary, in that case we don't need to
call pick_next_task cause - we don't have any task.

>>  In that case, that likely branch will just fail. And on an
>> UP system that slow path -- going into idle -- is the only way, taking
>> the fast path (trying picking a task) isn't the right thing, isn't
>> it?
> I'm not at all sure I even understand what you're trying to say. I
> really don't understand what's the problem with going the long way with
> picking the idle task, the machine is idle, it doesn't have anything
> useful to do, who cares.
Well, yes the machine is idle. I got your point that you're
emphasizing that CPU is idle even if we take long path it doesn't
matter. But, when we've two ways, one is going through pick_next_task
other is calling idle_class straight I think calling idle_class is
better. Actually that's how I think (and certainly it differs from
yours). Note that, in pick_next_task there is branch, which checks
likely(nr_running==cfs->nr_running) - chances for hitting this branch
will increase - cause in case of !nr_running, pick_next_task won't be
called. It will reduce pick_next_task's calling overhead.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists