public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: linux-kernel@vger.kernel.org
Cc: pjt@google.com, paul.mckenney@linaro.org, tglx@linutronix.de,
	tj@kernel.org, suresh.b.siddha@intel.com, venki@google.com,
	mingo@redhat.com, peterz@infradead.org, robin.randhawa@arm.com,
	Steve.Bannister@arm.com, Arvind.Chauhan@arm.com,
	amit.kucheria@linaro.org, vincent.guittot@linaro.org,
	linaro-dev@lists.linaro.org, patches@linaro.org,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 0/3] Create sched_select_cpu() and use it in workqueues
Date: Tue, 25 Sep 2012 16:06:05 +0530	[thread overview]
Message-ID: <cover.1348568074.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <viresh.kumar@linaro.org>

In order to save power, it would be useful to schedule work onto non-IDLE cpus
instead of waking up an IDLE one.

To achieve this, we need scheduler to guide kernel frameworks (like: timers &
workqueues) on which is the most preferred CPU that must be used for these
tasks.

This patchset is about implementing this concept.

The first patch adds sched_select_cpu() routine which returns the preferred cpu
which is non-idle. It accepts max level of sched domain, upto which we can
choose a CPU from. It can accept following options: SD_SIBLING, SD_MC, SD_BOOK,
SD_CPU or SD_NUMA.

Second and Third patch are about adapting this change in workqueue framework.

Earlier discussions over this concept were done at last LPC:
http://summit.linuxplumbersconf.org/lpc-2012/meeting/90/lpc2012-sched-timer-workqueue/

Figures:
--------

Test case 1:
- Performed on TC2 with ubuntu-devel
- Boot TC2 and run
 $ trace-cmd record -e workqueue_execute_start

This will trace only the points, where the work actually runs.

Do, this for 150 seconds.

Results:
---------
Domain 0: CPU 0-1
Domain 1: CPU 2-4


Base Kernel: Without my modifications:
-------------------------------------

CPU             No. of works run by CPU
-----           -----------------------
CPU0:           7
CPU1:           445
CPU2:           444
CPU3:           315
CPU4:           226


With my modifications:
----------------------

CPU             No. of works run by CPU
----            -----------------------
CPU0:           31
CPU2:           797
CPU3:           274
CPU4:           86


Test case 2:
-----------
I have created a small module, which does following:
- Create one work for each CPU (using queue_work_on(), so must schedule on that
  cpu)
- Above work, will queue "n" works for each cpu with queue_work(). These works
  are tracked within the module and results are printed at the end.

This gave similar results, with n ranging from 10 to 1000.

Viresh Kumar (3):
  sched: Create sched_select_cpu() to give preferred CPU for power
    saving
  workqueue: create __flush_delayed_work to avoid duplicating code
  workqueue: Schedule work on non-idle cpu instead of current one

 arch/arm/Kconfig      | 11 +++++++
 include/linux/sched.h | 11 +++++++
 kernel/sched/core.c   | 88 +++++++++++++++++++++++++++++++++++++++------------
 kernel/workqueue.c    | 36 ++++++++++++++-------
 4 files changed, 115 insertions(+), 31 deletions(-)

-- 
1.7.12.rc2.18.g61b472e



             reply	other threads:[~2012-09-25 10:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-25 10:36 Viresh Kumar [this message]
2012-09-25 10:36 ` [PATCH 1/3] sched: Create sched_select_cpu() to give preferred CPU for power saving Viresh Kumar
2012-09-25 10:52   ` Peter Zijlstra
2012-09-25 10:36 ` [PATCH 2/3] workqueue: create __flush_delayed_work to avoid duplicating code Viresh Kumar
2012-09-25 17:47   ` Tejun Heo
2012-09-26  4:22     ` Viresh Kumar
2012-09-25 10:36 ` [PATCH 3/3] workqueue: Schedule work on non-idle cpu instead of current one Viresh Kumar
2012-09-25 11:22   ` Peter Zijlstra
2012-09-25 11:30     ` Viresh Kumar
2012-09-25 11:38       ` Vincent Guittot
2012-09-25 11:40       ` Peter Zijlstra
2012-09-25 11:46         ` Peter Zijlstra
2012-09-25 17:56   ` Tejun Heo
2012-09-26 11:21     ` Viresh Kumar
2012-09-25 11:20 ` [PATCH 0/3] Create sched_select_cpu() and use it in workqueues Viresh Kumar

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=cover.1348568074.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=Arvind.Chauhan@arm.com \
    --cc=Steve.Bannister@arm.com \
    --cc=amit.kucheria@linaro.org \
    --cc=linaro-dev@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=patches@linaro.org \
    --cc=paul.mckenney@linaro.org \
    --cc=peterz@infradead.org \
    --cc=pjt@google.com \
    --cc=robin.randhawa@arm.com \
    --cc=suresh.b.siddha@intel.com \
    --cc=tglx@linutronix.de \
    --cc=tj@kernel.org \
    --cc=venki@google.com \
    --cc=vincent.guittot@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox