remarkable-linux/kernel
Mark Gross d82b35186e pm qos infrastructure and interface
The following patch is a generalization of the latency.c implementation done
by Arjan last year.  It provides infrastructure for more than one parameter,
and exposes a user mode interface for processes to register pm_qos
expectations of processes.

This interface provides a kernel and user mode interface for registering
performance expectations by drivers, subsystems and user space applications on
one of the parameters.

Currently we have {cpu_dma_latency, network_latency, network_throughput} as
the initial set of pm_qos parameters.

The infrastructure exposes multiple misc device nodes one per implemented
parameter.  The set of parameters implement is defined by pm_qos_power_init()
and pm_qos_params.h.  This is done because having the available parameters
being runtime configurable or changeable from a driver was seen as too easy to
abuse.

For each parameter a list of performance requirements is maintained along with
an aggregated target value.  The aggregated target value is updated with
changes to the requirement list or elements of the list.  Typically the
aggregated target value is simply the max or min of the requirement values
held in the parameter list elements.

>From kernel mode the use of this interface is simple:

pm_qos_add_requirement(param_id, name, target_value):

  Will insert a named element in the list for that identified PM_QOS
  parameter with the target value.  Upon change to this list the new target is
  recomputed and any registered notifiers are called only if the target value
  is now different.

pm_qos_update_requirement(param_id, name, new_target_value):

  Will search the list identified by the param_id for the named list element
  and then update its target value, calling the notification tree if the
  aggregated target is changed.  with that name is already registered.

pm_qos_remove_requirement(param_id, name):

  Will search the identified list for the named element and remove it, after
  removal it will update the aggregate target and call the notification tree
  if the target was changed as a result of removing the named requirement.

>From user mode:

  Only processes can register a pm_qos requirement.  To provide for
  automatic cleanup for process the interface requires the process to register
  its parameter requirements in the following way:

  To register the default pm_qos target for the specific parameter, the
  process must open one of /dev/[cpu_dma_latency, network_latency,
  network_throughput]

  As long as the device node is held open that process has a registered
  requirement on the parameter.  The name of the requirement is
  "process_<PID>" derived from the current->pid from within the open system
  call.

  To change the requested target value the process needs to write a s32
  value to the open device node.  This translates to a
  pm_qos_update_requirement call.

  To remove the user mode request for a target value simply close the device
  node.

[akpm@linux-foundation.org: fix warnings]
[akpm@linux-foundation.org: fix build]
[akpm@linux-foundation.org: fix build again]
[akpm@linux-foundation.org: coding-style fixes]
Signed-off-by: mark gross <mgross@linux.intel.com>
Cc: "John W. Linville" <linville@tuxdriver.com>
Cc: Len Brown <lenb@kernel.org>
Cc: Jaroslav Kysela <perex@suse.cz>
Cc: Takashi Iwai <tiwai@suse.de>
Cc: Arjan van de Ven <arjan@infradead.org>
Cc: Venki Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Adam Belay <abelay@novell.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-02-05 09:44:22 -08:00
..
irq genirq: stackdump after the "Trying to free already-free IRQ" message 2008-01-30 13:33:24 +01:00
power kernel/power/disk.c: make code static 2008-02-05 09:44:22 -08:00
time tick-sched: add more debug information 2008-02-01 17:45:14 +01:00
.gitignore
acct.c
audit.c [AUDIT] ratelimit printk messages audit 2008-02-01 14:25:04 -05:00
audit.h
audit_tree.c
auditfilter.c [AUDIT] make audit=0 really stop audit messages 2008-02-01 14:24:33 -05:00
auditsc.c [AUDIT] create context if auditing was ever enabled 2008-02-01 14:24:45 -05:00
backtracetest.c x86: add a simple backtrace test module 2008-01-30 13:33:08 +01:00
capability.c Add 64-bit capability support to the kernel 2008-02-05 09:44:20 -08:00
cgroup.c
cgroup_debug.c
compat.c
configs.c
cpu.c
cpuset.c
delayacct.c
dma.c
exec_domain.c
exit.c exec: rework the group exit and fix the race with kill 2008-02-05 09:44:07 -08:00
extable.c module: Don't report discarded init pages as kernel text. 2008-01-29 17:13:18 +11:00
fork.c capabilities: introduce per-process capability bounding set 2008-02-05 09:44:20 -08:00
futex.c futex: Add bitset conditional wait/wakeup functionality 2008-02-01 17:45:14 +01:00
futex_compat.c futex: Add bitset conditional wait/wakeup functionality 2008-02-01 17:45:14 +01:00
hrtimer.c timerfd: new timerfd API 2008-02-05 09:44:07 -08:00
itimer.c
kallsyms.c module: make module_address_lookup safe 2008-01-29 17:13:23 +11:00
Kconfig.hz sched: high-res preemption tick 2008-01-25 21:08:29 +01:00
Kconfig.preempt sched: remove the !PREEMPT_BKL code 2008-01-25 21:08:33 +01:00
kexec.c
kfifo.c
kmod.c
kprobes.c x86: kprobes: add kprobes smoke tests that run on boot 2008-01-30 13:32:53 +01:00
ksysfs.c
kthread.c sched: fix, always create kernel threads with normal priority 2008-01-25 21:08:33 +01:00
latency.c
latencytop.c sched: latencytop support 2008-01-25 21:08:34 +01:00
lockdep.c
lockdep_internals.h
lockdep_proc.c
Makefile pm qos infrastructure and interface 2008-02-05 09:44:22 -08:00
marker.c
module.c x86/non-x86: percpu, node ids, apic ids x86.git fixup 2008-01-30 13:33:32 +01:00
mutex-debug.c
mutex-debug.h
mutex.c
mutex.h
notifier.c
ns_cgroup.c
nsproxy.c
panic.c debug: add the end-of-trace marker and the module list to 2008-01-30 13:32:50 +01:00
params.c module: fix the module name length in param_sysfs_builtin 2008-01-29 17:13:24 +11:00
pid.c
pm_qos_params.c pm qos infrastructure and interface 2008-02-05 09:44:22 -08:00
posix-cpu-timers.c sched: rt-watchdog: fix .rlim_max = RLIM_INFINITY 2008-01-25 21:08:32 +01:00
posix-timers.c timerfd: new timerfd API 2008-02-05 09:44:07 -08:00
printk.c debug: turn ignore_loglevel into an early param 2008-01-31 22:45:23 +01:00
profile.c debug: clean up kernel/profile.c 2008-01-25 21:08:33 +01:00
ptrace.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
rcuclassic.c Preempt-RCU: implementation 2008-01-25 21:08:24 +01:00
rcupdate.c Preempt-RCU: fix rcu_barrier for preemptive environment. 2008-01-25 21:08:24 +01:00
rcupreempt.c Preempt-RCU: CPU Hotplug handling 2008-01-25 21:08:25 +01:00
rcupreempt_trace.c Preempt-RCU: implementation 2008-01-25 21:08:24 +01:00
rcutorture.c
relay.c vm audit: add VM_DONTEXPAND to mmap for drivers that need it 2008-02-04 07:55:38 -08:00
resource.c
rtmutex-debug.c
rtmutex-debug.h
rtmutex-tester.c
rtmutex.c
rtmutex.h
rtmutex_common.h
rwsem.c
sched.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
sched_debug.c sched: keep total / count stats in addition to the max for 2008-01-25 21:08:35 +01:00
sched_fair.c sched: let +nice tasks have smaller impact 2008-01-31 22:45:22 +01:00
sched_idletask.c sched: high-res preemption tick 2008-01-25 21:08:29 +01:00
sched_rt.c sched: fix goto retry in pick_next_task_rt() 2008-01-25 21:08:34 +01:00
sched_stats.h
seccomp.c
signal.c exec: rework the group exit and fix the race with kill 2008-02-05 09:44:07 -08:00
softirq.c time: track accurate idle time with tick_sched.idle_sleeptime 2008-01-30 13:30:04 +01:00
softlockup.c debug: softlockup looping fix 2008-02-02 14:27:45 +11:00
spinlock.c spinlock: lockbreak cleanup 2008-01-30 13:31:20 +01:00
srcu.c
stacktrace.c
stop_machine.c
sys.c make kernel_shutdown_prepare() static 2008-02-05 09:44:22 -08:00
sys_ni.c timerfd: new timerfd API 2008-02-05 09:44:07 -08:00
sysctl.c capabilities: introduce per-process capability bounding set 2008-02-05 09:44:20 -08:00
sysctl_check.c capabilities: introduce per-process capability bounding set 2008-02-05 09:44:20 -08:00
taskstats.c
test_kprobes.c x86: kprobes: add kprobes smoke tests that run on boot 2008-01-30 13:32:53 +01:00
time.c timekeeping: update xtime_cache when time(zone) changes 2008-02-01 17:45:13 +01:00
timer.c Merge branch 'task_killable' of git://git.kernel.org/pub/scm/linux/kernel/git/willy/misc 2008-02-01 11:45:47 +11:00
tsacct.c
uid16.c
user.c uids: merge multiple error paths in alloc_uid() into one 2008-01-25 21:08:26 +01:00
user_namespace.c
utsname.c
utsname_sysctl.c
wait.c
workqueue.c