blob: 0adeda93b5fb56e3086a3a059338ab2cc8fc58ba [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Juri Lelli6bfd6d72013-11-07 14:43:47 +01002
Ingo Molnar97fb7a02018-03-03 14:01:12 +01003#define IDX_INVALID -1
Juri Lelli6bfd6d72013-11-07 14:43:47 +01004
Peter Zijlstra944770a2014-05-14 16:13:56 +02005struct cpudl_item {
Ingo Molnar97fb7a02018-03-03 14:01:12 +01006 u64 dl;
7 int cpu;
8 int idx;
Juri Lelli6bfd6d72013-11-07 14:43:47 +01009};
10
11struct cpudl {
Ingo Molnar97fb7a02018-03-03 14:01:12 +010012 raw_spinlock_t lock;
13 int size;
14 cpumask_var_t free_cpus;
15 struct cpudl_item *elements;
Juri Lelli6bfd6d72013-11-07 14:43:47 +010016};
17
Juri Lelli6bfd6d72013-11-07 14:43:47 +010018#ifdef CONFIG_SMP
Ingo Molnar97fb7a02018-03-03 14:01:12 +010019int cpudl_find(struct cpudl *cp, struct task_struct *p, struct cpumask *later_mask);
Tommaso Cucinottad8206bb2016-08-14 16:27:08 +020020void cpudl_set(struct cpudl *cp, int cpu, u64 dl);
21void cpudl_clear(struct cpudl *cp, int cpu);
Ingo Molnar97fb7a02018-03-03 14:01:12 +010022int cpudl_init(struct cpudl *cp);
Xunlei Pang16b26942015-01-19 04:49:36 +000023void cpudl_set_freecpu(struct cpudl *cp, int cpu);
24void cpudl_clear_freecpu(struct cpudl *cp, int cpu);
Juri Lelli6bfd6d72013-11-07 14:43:47 +010025void cpudl_cleanup(struct cpudl *cp);
Juri Lelli6bfd6d72013-11-07 14:43:47 +010026#endif /* CONFIG_SMP */