Re: [PATCH] sched: Check nr_running before calling pick_next_task in schedule().

Rakib Mullick
2011-07-09T04:43:19Z

[-- Attachment #1: Type: text/plain, Size: 1274 bytes --]

On Sat, Jul 2, 2011 at 8:26 PM, Rakib Mullick <rakib.mullick@gmail.com> wrote:
> On Sat, Jul 2, 2011 at 3:51 PM, Peter Zijlstra <peterz@infradead.org> wrote:
>> On Sat, 2011-07-02 at 00:41 +0600, Rakib Mullick wrote:
>
>> You've completely failed to provide any sort of rationale for the patch
>> nor did you provide a use-case with performance numbers. This just isn't
>> making much sense at all.
>>
> Regarding taking branch, it needs performance numbers - I agree. But,
> I'm not quite agree that - it's not just making any sense. Will try to
> do some performance testing on it.

I tried to do some testing with the applied patch using kernbench
(with likely branch removed). I did it twice with load -j {,2,4,6,8}.
Kernel version tagged with -schedpatch indicates kernel with this
applied and -noschedpatch is the default. In first case, with this
patch applied Elapsed time is lesser. In the second run with -j 2 and
-j 4 -schedpatch kernel is slow, but with -j 6 and -j 8 it takes less
elapsed time. Also tested with 'nosmp', with this patch, elapsed time
is lesser. So, for better interpretation and full log of test results
I'm attaching the kernbench.log. Please, see whether it looks
convincing to you or not. Tests are done on core i3 machine.

Thanks,
Rakib

[-- Attachment #2: kernbench.log --]
[-- Type: application/octet-stream, Size: 5358 bytes --]

Sun Jul 3 10:40:56 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 4 Run (std deviation):
Elapsed Time 13.61 (0.0608276)
User Time 27.5967 (0.12897)
System Time 14.2133 (0.119303)
Percent CPU 306.667 (2.51661)
Context Switches 7989.33 (58.398)
Sleeps 10866.3 (43.6157)

Sun Jul 3 10:50:56 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 4 Run (std deviation):
Elapsed Time 13.65 (0.127671)
User Time 27.54 (0.112694)
System Time 14.1467 (0.155027)
Percent CPU 305 (3)
Context Switches 7983.33 (165.171)
Sleeps 10902.3 (135.795)

Sun Jul 3 11:01:14 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 2 Run (std deviation):
Elapsed Time 17.63 (0.31241)
User Time 19.4333 (0.115036)
System Time 10.21 (0.0264575)
Percent CPU 167.667 (3.21455)
Context Switches 8419 (75.6241)
Sleeps 10580.7 (75.7254)

Sun Jul 3 11:12:36 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 2 Run (std deviation):
Elapsed Time 17.6067 (0.140475)
User Time 19.4033 (0.153079)
System Time 10.17 (0.105357)
Percent CPU 167.333 (1.1547)
Context Switches 8371.33 (16.1658)
Sleeps 10548.3 (17.0392)

Wed Jul 6 22:24:19 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 6 Run (std deviation):
Elapsed Time 13.5833 (0.0450925)
User Time 28.3067 (0.176163)
System Time 14.6033 (0.143643)
Percent CPU 315.333 (1.1547)
Context Switches 9239 (90.3715)
Sleeps 11119.3 (38.0175)

Wed Jul 6 22:34:05 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 6 Run (std deviation):
Elapsed Time 13.8433 (0.433628)
User Time 27.9667 (0.390042)
System Time 14.6133 (0.0757188)
Percent CPU 307.333 (12.4231)
Context Switches 9409.33 (84.2397)
Sleeps 11415 (328.638)

Wed Jul 6 22:41:46 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 8 Run (std deviation):
Elapsed Time 13.6133 (0.065064)
User Time 28.5367 (0.0208167)
System Time 14.6733 (0.133166)
Percent CPU 316.667 (0.57735)
Context Switches 9486 (135.104)
Sleeps 11842.7 (263.788)

Wed Jul 6 22:51:42 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 8 Run (std deviation):
Elapsed Time 13.5733 (0.061101)
User Time 28.4833 (0.080208)
System Time 14.5933 (0.100664)
Percent CPU 317 (1)
Context Switches 9547 (70.7036)
Sleeps 11855.7 (35.0761)

<============================================>

Fri Jul 8 08:22:29 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 2 Run (std deviation):
Elapsed Time 17.746 (0.487217)
User Time 19.424 (0.145017)
System Time 10.218 (0.0816701)
Percent CPU 166.4 (3.78153)
Context Switches 8385.4 (49.687)
Sleeps 10594 (76.7887)

Fri Jul 8 08:30:37 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 4 Run (std deviation):
Elapsed Time 13.718 (0.339809)
User Time 27.95 (0.246069)
System Time 14.546 (0.255402)
Percent CPU 309.4 (4.27785)
Context Switches 7838.4 (92.6569)
Sleeps 11082.2 (648.594)

Fri Jul 8 08:38:23 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 6 Run (std deviation):
Elapsed Time 13.506 (0.0844393)
User Time 28.33 (0.0977241)
System Time 14.584 (0.118025)
Percent CPU 317.2 (1.64317)
Context Switches 9345.6 (90.7045)
Sleeps 11046 (106.59)

Fri Jul 8 08:46:11 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 8 Run (std deviation):
Elapsed Time 13.566 (0.0466905)
User Time 28.63 (0.05)
System Time 14.566 (0.0770065)
Percent CPU 318 (1)
Context Switches 9352.8 (103.323)
Sleeps 11805.8 (122.534)

Fri Jul 8 09:00:10 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 2 Run (std deviation):
Elapsed Time 17.628 (0.463379)
User Time 19.426 (0.100399)
System Time 10.162 (0.10663)
Percent CPU 167.6 (4.39318)
Context Switches 8370.2 (24.8636)
Sleeps 10568.4 (99.2184)

Fri Jul 8 09:08:20 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 4 Run (std deviation):
Elapsed Time 13.598 (0.172974)
User Time 27.846 (0.105262)
System Time 14.464 (0.0750333)
Percent CPU 310.6 (3.97492)
Context Switches 7799.8 (81.561)
Sleeps 10784.6 (64.5508)

Fri Jul 8 09:15:46 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 6 Run (std deviation):
Elapsed Time 14.296 (0.972538)
User Time 27.796 (0.320047)
System Time 14.488 (0.191755)
Percent CPU 296.4 (21.1967)
Context Switches 10623.6 (499.773)
Sleeps 11212.8 (202.849)

Fri Jul 8 09:23:51 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 8 Run (std deviation):
Elapsed Time 13.614 (0.0219089)
User Time 28.674 (0.0270185)
System Time 14.658 (0.100349)
Percent CPU 317.8 (0.83666)
Context Switches 9374.2 (93.1166)
Sleeps 11795.4 (187.807)

<================= nosmp tests==============>

Fri Jul 8 09:44:14 BDT 2011
3.0.0-rc5-tip-schedpatch-gbc7db00-dirty
Average Optimal load -j 1 Run (std deviation):
Elapsed Time 31.364 (0.817484)
User Time 18.248 (0.0526308)
System Time 8.69 (0.0961769)
Percent CPU 85.4 (1.94936)
Context Switches 5713.2 (24.9339)
Sleeps 10624 (64.5717)

Fri Jul 8 10:02:55 BDT 2011
3.0.0-rc5-tip-noschedpatch-gbc7db00
Average Optimal load -j 1 Run (std deviation):
Elapsed Time 32.868 (1.02021)
User Time 18.268 (0.0923038)
System Time 8.79 (0.109316)
Percent CPU 81.8 (2.16795)
Context Switches 5826.2 (74.5064)
Sleeps 10787 (117.712)
<================= nosmp end ==============>