blob: 5364e2bcac2037ba6ce6830f5a0b2e9fc5a60f2e (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
/* FIFO common definitions and utility functions.
*/
#ifndef __UNC_SCHED_FIFO_H__
#define __UNC_SCHED_FIFO_H__
typedef struct {
struct list_head queue;
atomic_t count;
spinlock_t lock;
unsigned int time_slice;
} fifo_domain_t;
#define FIFO_INIT(name, time_slice) \
{ LIST_HEAD_INIT(name.queue), \
ATOMIC_INIT(0), \
SPIN_LOCK_UNLOCKED, \
time_slice}
void fifo_domain_init(fifo_domain_t* fifo, unsigned int exec_budget);
void fifo_enqueue(fifo_domain_t* fifo, struct task_struct* task);
void fifo_add(fifo_domain_t* fifo, struct task_struct* task);
void lifo_add(fifo_domain_t* fifo, struct task_struct* task);
struct task_struct* __fifo_take(fifo_domain_t* fifo);
struct task_struct* fifo_take(fifo_domain_t* fifo);
struct task_struct* fifo_take_rq(fifo_domain_t* fifo, runqueue_t* rq, int cpu);
static inline int fifo_jobs_pending(fifo_domain_t* fifo)
{
return atomic_read(&fifo->count) > 0;
}
#endif
|