public inbox for linux-mmc@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH V3 5/7] mmc: queue work on any cpu
       [not found] <cover.1363617402.git.viresh.kumar@linaro.org>
@ 2013-03-18 15:23 ` Viresh Kumar
  2013-03-19  7:58   ` Ulf Hansson
                     ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Viresh Kumar @ 2013-03-18 15:23 UTC (permalink / raw)
  To: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt
  Cc: linaro-kernel, robin.randhawa, Steve.Bannister, Liviu.Dudau,
	charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, Viresh Kumar, Chris Ball, linux-mmc

mmc uses workqueues for running mmc_rescan(). There is no real dependency of
scheduling these on the cpu which scheduled them.

On a idle system, it is observed that and idle cpu wakes up many times just to
service this work. It would be better if we can schedule it on a cpu which isn't
idle to save on power.

By idle cpu (from scheduler's perspective) we mean:
- Current task is idle task
- nr_running == 0
- wake_list is empty

This patch replaces the queue_delayed_work() with
queue_delayed_work_on_any_cpu() siblings.

This routine would look for the closest (via scheduling domains) non-idle cpu
(non-idle from schedulers perspective). If the current cpu is not idle or all
cpus are idle, work will be scheduled on local cpu.

Cc: Chris Ball <cjb@laptop.org>
Cc: linux-mmc@vger.kernel.org
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/mmc/core/core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
index 9290bb5..adf331a 100644
--- a/drivers/mmc/core/core.c
+++ b/drivers/mmc/core/core.c
@@ -85,7 +85,7 @@ MODULE_PARM_DESC(
 static int mmc_schedule_delayed_work(struct delayed_work *work,
 				     unsigned long delay)
 {
-	return queue_delayed_work(workqueue, work, delay);
+	return queue_delayed_work_on_any_cpu(workqueue, work, delay);
 }
 
 /*
-- 
1.7.12.rc2.18.g61b472e

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH V3 5/7] mmc: queue work on any cpu
  2013-03-18 15:23 ` [PATCH V3 5/7] mmc: queue work on any cpu Viresh Kumar
@ 2013-03-19  7:58   ` Ulf Hansson
  2013-03-22 17:09   ` Chris Ball
  2013-03-22 17:26   ` Chris Ball
  2 siblings, 0 replies; 6+ messages in thread
From: Ulf Hansson @ 2013-03-19  7:58 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt, linaro-kernel, robin.randhawa, Steve.Bannister,
	Liviu.Dudau, charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, Chris Ball, linux-mmc

On 18 March 2013 16:23, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> mmc uses workqueues for running mmc_rescan(). There is no real dependency of
> scheduling these on the cpu which scheduled them.
>
> On a idle system, it is observed that and idle cpu wakes up many times just to
> service this work. It would be better if we can schedule it on a cpu which isn't
> idle to save on power.
>
> By idle cpu (from scheduler's perspective) we mean:
> - Current task is idle task
> - nr_running == 0
> - wake_list is empty
>
> This patch replaces the queue_delayed_work() with
> queue_delayed_work_on_any_cpu() siblings.
>
> This routine would look for the closest (via scheduling domains) non-idle cpu
> (non-idle from schedulers perspective). If the current cpu is not idle or all
> cpus are idle, work will be scheduled on local cpu.
>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/mmc/core/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9290bb5..adf331a 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -85,7 +85,7 @@ MODULE_PARM_DESC(
>  static int mmc_schedule_delayed_work(struct delayed_work *work,
>                                      unsigned long delay)
>  {
> -       return queue_delayed_work(workqueue, work, delay);
> +       return queue_delayed_work_on_any_cpu(workqueue, work, delay);
>  }
>
>  /*
> --
> 1.7.12.rc2.18.g61b472e
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3 5/7] mmc: queue work on any cpu
  2013-03-18 15:23 ` [PATCH V3 5/7] mmc: queue work on any cpu Viresh Kumar
  2013-03-19  7:58   ` Ulf Hansson
@ 2013-03-22 17:09   ` Chris Ball
  2013-03-22 17:26   ` Chris Ball
  2 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-03-22 17:09 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt, linaro-kernel, robin.randhawa, Steve.Bannister,
	Liviu.Dudau, charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, linux-mmc

Hi,

On Mon, Mar 18 2013, Viresh Kumar wrote:
> mmc uses workqueues for running mmc_rescan(). There is no real dependency of
> scheduling these on the cpu which scheduled them.
>
> On a idle system, it is observed that and idle cpu wakes up many times just to
> service this work. It would be better if we can schedule it on a cpu which isn't
> idle to save on power.
>
> By idle cpu (from scheduler's perspective) we mean:
> - Current task is idle task
> - nr_running == 0
> - wake_list is empty
>
> This patch replaces the queue_delayed_work() with
> queue_delayed_work_on_any_cpu() siblings.
>
> This routine would look for the closest (via scheduling domains) non-idle cpu
> (non-idle from schedulers perspective). If the current cpu is not idle or all
> cpus are idle, work will be scheduled on local cpu.
>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/mmc/core/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9290bb5..adf331a 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -85,7 +85,7 @@ MODULE_PARM_DESC(
>  static int mmc_schedule_delayed_work(struct delayed_work *work,
>  				     unsigned long delay)
>  {
> -	return queue_delayed_work(workqueue, work, delay);
> +	return queue_delayed_work_on_any_cpu(workqueue, work, delay);
>  }
>  
>  /*

Thanks, pushed to mmc-next for 3.10.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3 5/7] mmc: queue work on any cpu
  2013-03-18 15:23 ` [PATCH V3 5/7] mmc: queue work on any cpu Viresh Kumar
  2013-03-19  7:58   ` Ulf Hansson
  2013-03-22 17:09   ` Chris Ball
@ 2013-03-22 17:26   ` Chris Ball
  2013-03-22 17:27     ` Viresh Kumar
  2 siblings, 1 reply; 6+ messages in thread
From: Chris Ball @ 2013-03-22 17:26 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt, linaro-kernel, robin.randhawa, Steve.Bannister,
	Liviu.Dudau, charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, linux-mmc

Hi,

On Mon, Mar 18 2013, Viresh Kumar wrote:
> mmc uses workqueues for running mmc_rescan(). There is no real dependency of
> scheduling these on the cpu which scheduled them.
>
> On a idle system, it is observed that and idle cpu wakes up many times just to
> service this work. It would be better if we can schedule it on a cpu which isn't
> idle to save on power.
>
> By idle cpu (from scheduler's perspective) we mean:
> - Current task is idle task
> - nr_running == 0
> - wake_list is empty
>
> This patch replaces the queue_delayed_work() with
> queue_delayed_work_on_any_cpu() siblings.
>
> This routine would look for the closest (via scheduling domains) non-idle cpu
> (non-idle from schedulers perspective). If the current cpu is not idle or all
> cpus are idle, work will be scheduled on local cpu.
>
> Cc: Chris Ball <cjb@laptop.org>
> Cc: linux-mmc@vger.kernel.org
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/mmc/core/core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c
> index 9290bb5..adf331a 100644
> --- a/drivers/mmc/core/core.c
> +++ b/drivers/mmc/core/core.c
> @@ -85,7 +85,7 @@ MODULE_PARM_DESC(
>  static int mmc_schedule_delayed_work(struct delayed_work *work,
>  				     unsigned long delay)
>  {
> -	return queue_delayed_work(workqueue, work, delay);
> +	return queue_delayed_work_on_any_cpu(workqueue, work, delay);
>  }
>  
>  /*

/home/cjb/git/mmc/drivers/mmc/core/core.c: In function ‘mmc_schedule_delayed_work’:
/home/cjb/git/mmc/drivers/mmc/core/core.c:88:2: error: implicit declaration of function ‘queue_delayed_work_on_any_cpu’ [-Werror=implicit-function-declaration]

I've dropped this patch for now.  This function doesn't seem to be
defined in linux-next either.

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3 5/7] mmc: queue work on any cpu
  2013-03-22 17:26   ` Chris Ball
@ 2013-03-22 17:27     ` Viresh Kumar
  2013-03-22 17:30       ` Chris Ball
  0 siblings, 1 reply; 6+ messages in thread
From: Viresh Kumar @ 2013-03-22 17:27 UTC (permalink / raw)
  To: Chris Ball
  Cc: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt, linaro-kernel, robin.randhawa, Steve.Bannister,
	Liviu.Dudau, charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, linux-mmc

On 22 March 2013 22:56, Chris Ball <cjb@laptop.org> wrote:
> On Mon, Mar 18 2013, Viresh Kumar wrote:
>
> /home/cjb/git/mmc/drivers/mmc/core/core.c: In function ‘mmc_schedule_delayed_work’:
> /home/cjb/git/mmc/drivers/mmc/core/core.c:88:2: error: implicit declaration of function ‘queue_delayed_work_on_any_cpu’ [-Werror=implicit-function-declaration]
>
> I've dropped this patch for now.  This function doesn't seem to be
> defined in linux-next either.

Hi chris,

This patch was part of a bigger patchset which also adds this API. I
don't want you to
apply this one but just Ack here. Probably Tejun or some scheduler
maintainer will
apply it later (if they like all patches).

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH V3 5/7] mmc: queue work on any cpu
  2013-03-22 17:27     ` Viresh Kumar
@ 2013-03-22 17:30       ` Chris Ball
  0 siblings, 0 replies; 6+ messages in thread
From: Chris Ball @ 2013-03-22 17:30 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: pjt, paul.mckenney, tglx, tj, suresh.b.siddha, venki, mingo,
	peterz, rostedt, linaro-kernel, robin.randhawa, Steve.Bannister,
	Liviu.Dudau, charles.garcia-tobin, Arvind.Chauhan, linux-rt-users,
	linux-kernel, linux-mmc

Hi,

On Fri, Mar 22 2013, Viresh Kumar wrote:
> On 22 March 2013 22:56, Chris Ball <cjb@laptop.org> wrote:
>> On Mon, Mar 18 2013, Viresh Kumar wrote:
>>
>> /home/cjb/git/mmc/drivers/mmc/core/core.c: In function
>> ‘mmc_schedule_delayed_work’:
>> /home/cjb/git/mmc/drivers/mmc/core/core.c:88:2: error: implicit
>> declaration of function ‘queue_delayed_work_on_any_cpu’
>> [-Werror=implicit-function-declaration]
>>
>> I've dropped this patch for now.  This function doesn't seem to be
>> defined in linux-next either.
>
> Hi chris,
>
> This patch was part of a bigger patchset which also adds this API. I
> don't want you to
> apply this one but just Ack here. Probably Tejun or some scheduler
> maintainer will
> apply it later (if they like all patches).

Thanks, makes sense.  For [5/7]:

Acked-by: Chris Ball <cjb@laptop.org>

- Chris.
-- 
Chris Ball   <cjb@laptop.org>   <http://printf.net/>
One Laptop Per Child

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-03-22 17:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <cover.1363617402.git.viresh.kumar@linaro.org>
2013-03-18 15:23 ` [PATCH V3 5/7] mmc: queue work on any cpu Viresh Kumar
2013-03-19  7:58   ` Ulf Hansson
2013-03-22 17:09   ` Chris Ball
2013-03-22 17:26   ` Chris Ball
2013-03-22 17:27     ` Viresh Kumar
2013-03-22 17:30       ` Chris Ball

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox