Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-15 Thread Peter Zijlstra
On Mon, Jul 14, 2014 at 12:50:50PM -0700, Tim Chen wrote: There is a generic multi-buffer infrastructure portion that manages pulling and queuing jobs on the crypto workqueue, and it is separated out in patch 1 of the patchset. There's one very weird multi-line comment in that patch. The

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-15 Thread Peter Zijlstra
On Tue, Jul 15, 2014 at 11:50:45AM +0200, Peter Zijlstra wrote: So you already have an idle notifier (which is x86 only, we should fix that I suppose), and you then double check there really isn't anything else running. Note that we've already done a large part of the expense of going idle by

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-15 Thread Peter Zijlstra
On Tue, Jul 15, 2014 at 04:45:25PM +0200, Mike Galbraith wrote: 3.0.101-default3.753363 usecs/loop -- avg 3.770737 530.4 KHz 1.000 3.14.10-default4.145348 usecs/loop -- avg 4.139987 483.1 KHz.910 1.000 3.15.4-default 4.355594 usecs/loop -- avg 4.351961

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-15 Thread Mike Galbraith
On Tue, 2014-07-15 at 21:03 +0200, Peter Zijlstra wrote: On Tue, Jul 15, 2014 at 08:06:55PM +0200, Mike Galbraith wrote: On Tue, 2014-07-15 at 16:53 +0200, Peter Zijlstra wrote: On Tue, Jul 15, 2014 at 04:45:25PM +0200, Mike Galbraith wrote: 3.0.101-default3.753363

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-15 Thread Thomas Gleixner
On Tue, 15 Jul 2014, Tim Chen wrote: On Tue, 2014-07-15 at 14:59 +0200, Thomas Gleixner wrote: On Tue, 15 Jul 2014, Peter Zijlstra wrote: On Tue, Jul 15, 2014 at 11:50:45AM +0200, Peter Zijlstra wrote: So you already have an idle notifier (which is x86 only, we should fix that I

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Mon, 2014-07-14 at 12:16 +0200, Peter Zijlstra wrote: On Fri, Jul 11, 2014 at 01:33:04PM -0700, Tim Chen wrote: This function will help a thread decide if it wants to to do work that can be delayed, to accumulate more tasks for more efficient batch processing later. However, if no

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Peter Zijlstra
On Mon, Jul 14, 2014 at 09:10:14AM -0700, Tim Chen wrote: On Mon, 2014-07-14 at 12:16 +0200, Peter Zijlstra wrote: On Fri, Jul 11, 2014 at 01:33:04PM -0700, Tim Chen wrote: This function will help a thread decide if it wants to to do work that can be delayed, to accumulate more tasks for

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Mon, 2014-07-14 at 18:14 +0200, Peter Zijlstra wrote: On Mon, Jul 14, 2014 at 09:10:14AM -0700, Tim Chen wrote: On Mon, 2014-07-14 at 12:16 +0200, Peter Zijlstra wrote: On Fri, Jul 11, 2014 at 01:33:04PM -0700, Tim Chen wrote: This function will help a thread decide if it wants to to

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Sat, 2014-07-12 at 13:25 +0400, Kirill Tkhai wrote: +unsigned long nr_running_cpu(int cpu) +{ + if (cpumask_test_cpu(cpu, cpu_online_mask)) + return cpu_rq(cpu)-nr_running; + else + return 0; +} + Offline cpu should have nr_running equal to 0. We

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Peter Zijlstra
On Mon, Jul 14, 2014 at 10:05:34AM -0700, Tim Chen wrote: I was trying to explain why the algorithm is implemented this way because of its batching nature. There is a whole class of async algorithm that can provide substantial speedup by doing batch processing and uses workqueue. The

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Mon, 2014-07-14 at 20:17 +0200, Peter Zijlstra wrote: On Mon, Jul 14, 2014 at 10:05:34AM -0700, Tim Chen wrote: I was trying to explain why the algorithm is implemented this way because of its batching nature. There is a whole class of async algorithm that can provide substantial

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Peter Zijlstra
On Mon, Jul 14, 2014 at 12:08:28PM -0700, Tim Chen wrote: On Mon, 2014-07-14 at 20:17 +0200, Peter Zijlstra wrote: Your multi-buffer thing isn't generic either, it seems lmiited to sha1. We actually have many other multi-buffer crypto algorithms already published for encryption and other

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Mon, 2014-07-14 at 21:15 +0200, Peter Zijlstra wrote: On Mon, Jul 14, 2014 at 12:08:28PM -0700, Tim Chen wrote: On Mon, 2014-07-14 at 20:17 +0200, Peter Zijlstra wrote: Your multi-buffer thing isn't generic either, it seems lmiited to sha1. We actually have many other multi-buffer

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-14 Thread Tim Chen
On Sat, 2014-07-12 at 07:21 -0700, Tadeusz Struk wrote: On 07/11/2014 01:33 PM, Tim Chen wrote: +unsigned long nr_running_cpu(int cpu) +{ + if (cpumask_test_cpu(cpu, cpu_online_mask)) + return cpu_rq(cpu)-nr_running; + else + return 0; +} + EXPORT_SYMBOL?

Re: [PATCH v4 6/7] sched: add function nr_running_cpu to expose number of tasks running on cpu

2014-07-12 Thread Kirill Tkhai
On 12.07.2014 00:33, Tim Chen wrote: This function will help a thread decide if it wants to to do work that can be delayed, to accumulate more tasks for more efficient batch processing later. However, if no other tasks are running on the cpu, it can take advantgae of the available cpu