Lines Matching +full:3 +full:- +full:pole
1 // SPDX-License-Identifier: GPL-2.0-or-later
3 #include "cpuset-internal.h"
14 * Frequency meter - How fast is some event occurring?
18 * fmeter_init() - initialize a frequency meter.
19 * fmeter_markevent() - called each time the event happens.
20 * fmeter_getrate() - returns the recent rate of such events.
21 * fmeter_update() - internal routine used to update fmeter.
28 * The filter is single-pole low-pass recursive (IIR). The time unit
29 * is 1 second. Arithmetic is done using 32-bit integers scaled to
30 * simulate 3 decimal digits of precision (multiplied by 1000).
33 * has a half-life of 10 seconds, meaning that if the events quit
58 #define FM_COEF 933 /* coefficient for half-life of 10 secs */
66 fmp->cnt = 0; in fmeter_init()
67 fmp->val = 0; in fmeter_init()
68 fmp->time = 0; in fmeter_init()
69 spin_lock_init(&fmp->lock); in fmeter_init()
72 /* Internal meter update - process cnt events and update value */
79 ticks = now - fmp->time; in fmeter_update()
85 while (ticks-- > 0) in fmeter_update()
86 fmp->val = (FM_COEF * fmp->val) / FM_SCALE; in fmeter_update()
87 fmp->time = now; in fmeter_update()
89 fmp->val += ((FM_SCALE - FM_COEF) * fmp->cnt) / FM_SCALE; in fmeter_update()
90 fmp->cnt = 0; in fmeter_update()
96 spin_lock(&fmp->lock); in fmeter_markevent()
98 fmp->cnt = min(FM_MAXCNT, fmp->cnt + FM_SCALE); in fmeter_markevent()
99 spin_unlock(&fmp->lock); in fmeter_markevent()
107 spin_lock(&fmp->lock); in fmeter_getrate()
109 val = fmp->val; in fmeter_getrate()
110 spin_unlock(&fmp->lock); in fmeter_getrate()
123 * __cpuset_memory_pressure_bump - keep stats of per-cpuset reclaims.
134 * Display to user space in the per-cpuset read-only file
143 fmeter_markevent(&task_cs(current)->fmeter); in __cpuset_memory_pressure_bump()
150 if (val < -1 || val > sched_domain_level_max + 1) in update_relax_domain_level()
151 return -EINVAL; in update_relax_domain_level()
154 if (val != cs->relax_domain_level) { in update_relax_domain_level()
155 cs->relax_domain_level = val; in update_relax_domain_level()
156 if (!cpumask_empty(cs->cpus_allowed) && in update_relax_domain_level()
168 cpuset_filetype_t type = cft->private; in cpuset_write_s64()
169 int retval = -ENODEV; in cpuset_write_s64()
181 retval = -EINVAL; in cpuset_write_s64()
193 cpuset_filetype_t type = cft->private; in cpuset_read_s64()
197 return cs->relax_domain_level; in cpuset_read_s64()
230 * cpuset1_update_tasks_flags - update the spread flags of tasks in the cpuset.
242 css_task_iter_start(&cs->css, 0, &it); in cpuset1_update_tasks_flags()
253 * cpuset to its next-highest non-empty parent.
260 * Find its next-highest non-empty parent, (top cpuset in remove_tasks_in_empty_cpuset()
264 while (cpumask_empty(parent->cpus_allowed) || in remove_tasks_in_empty_cpuset()
265 nodes_empty(parent->mems_allowed)) in remove_tasks_in_empty_cpuset()
268 if (cgroup_transfer_tasks(parent->css.cgroup, cs->css.cgroup)) { in remove_tasks_in_empty_cpuset()
270 pr_cont_cgroup_name(cs->css.cgroup); in remove_tasks_in_empty_cpuset()
280 remove_tasks_in_empty_cpuset(s->cs); in cpuset_migrate_tasks_workfn()
281 css_put(&s->cs->css); in cpuset_migrate_tasks_workfn()
292 cpumask_copy(cs->cpus_allowed, new_cpus); in cpuset1_hotplug_update_tasks()
293 cpumask_copy(cs->effective_cpus, new_cpus); in cpuset1_hotplug_update_tasks()
294 cs->mems_allowed = *new_mems; in cpuset1_hotplug_update_tasks()
295 cs->effective_mems = *new_mems; in cpuset1_hotplug_update_tasks()
302 if (cpus_updated && !cpumask_empty(cs->cpus_allowed)) in cpuset1_hotplug_update_tasks()
304 if (mems_updated && !nodes_empty(cs->mems_allowed)) in cpuset1_hotplug_update_tasks()
307 is_empty = cpumask_empty(cs->cpus_allowed) || in cpuset1_hotplug_update_tasks()
308 nodes_empty(cs->mems_allowed); in cpuset1_hotplug_update_tasks()
315 if (is_empty && cs->css.cgroup->nr_populated_csets && in cpuset1_hotplug_update_tasks()
316 css_tryget_online(&cs->css)) { in cpuset1_hotplug_update_tasks()
321 css_put(&cs->css); in cpuset1_hotplug_update_tasks()
325 s->cs = cs; in cpuset1_hotplug_update_tasks()
326 INIT_WORK(&s->work, cpuset_migrate_tasks_workfn); in cpuset1_hotplug_update_tasks()
327 schedule_work(&s->work); in cpuset1_hotplug_update_tasks()
332 * is_cpuset_subset(p, q) - Is cpuset p a subset of cpuset q?
341 return cpumask_subset(p->cpus_allowed, q->cpus_allowed) && in is_cpuset_subset()
342 nodes_subset(p->mems_allowed, q->mems_allowed) && in is_cpuset_subset()
348 * cpuset1_validate_change() - Validate conditions specific to legacy (v1)
360 ret = -EBUSY; in cpuset1_validate_change()
366 ret = -EACCES; in cpuset1_validate_change()
379 cpuset_filetype_t type = cft->private; in cpuset_read_u64()
395 return fmeter_getrate(&cs->fmeter); in cpuset_read_u64()
412 cpuset_filetype_t type = cft->private; in cpuset_write_u64()
418 retval = -ENODEV; in cpuset_write_u64()
448 retval = -EINVAL; in cpuset_write_u64()