Commit 28287033e12463c8ff89f1ea8038783d0360391c

Authored by Venki Pallipadi
Committed by Linus Torvalds
1 parent 6e453a6751

Add a new deferrable delayed work init

Add a new deferrable delayed work init.  This can be used to schedule work
that are 'unimportant' when CPU is idle and can be called later, when CPU
eventually comes out of idle.

Use this init in cpufreq ondemand governor.

Signed-off-by: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Dave Jones <davej@codemonkey.org.uk>
Cc: Oleg Nesterov <oleg@tv-sign.ru>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

Showing 2 changed files with 7 additions and 1 deletions Side-by-side Diff

drivers/cpufreq/cpufreq_ondemand.c
... ... @@ -470,7 +470,7 @@
470 470 dbs_info->enable = 1;
471 471 ondemand_powersave_bias_init();
472 472 dbs_info->sample_type = DBS_NORMAL_SAMPLE;
473   - INIT_DELAYED_WORK(&dbs_info->work, do_dbs_timer);
  473 + INIT_DELAYED_WORK_DEFERRABLE(&dbs_info->work, do_dbs_timer);
474 474 queue_delayed_work_on(dbs_info->cpu, kondemand_wq, &dbs_info->work,
475 475 delay);
476 476 }
include/linux/workqueue.h
... ... @@ -121,6 +121,12 @@
121 121 init_timer(&(_work)->timer); \
122 122 } while (0)
123 123  
  124 +#define INIT_DELAYED_WORK_DEFERRABLE(_work, _func) \
  125 + do { \
  126 + INIT_WORK(&(_work)->work, (_func)); \
  127 + init_timer_deferrable(&(_work)->timer); \
  128 + } while (0)
  129 +
124 130 /**
125 131 * work_pending - Find out whether a work item is currently pending
126 132 * @work: The work item in question