aboutsummaryrefslogtreecommitdiffstats
path: root/xen/include/xen/sched-if.h
blob: 47fb6452f0428cd12f494904945c7a3918a00407 (plain)
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/******************************************************************************
 * Additional declarations for the generic scheduler interface.  This should
 * only be included by files that implement conforming schedulers.
 *
 * Portions by Mark Williamson are (C) 2004 Intel Research Cambridge
 */

#ifndef __XEN_SCHED_IF_H__
#define __XEN_SCHED_IF_H__

#define BUCKETS  10
/*300*/

struct schedule_data {
    spinlock_t          schedule_lock;  /* spinlock protecting curr        */
    struct exec_domain *curr;           /* current task                    */
    struct exec_domain *idle;           /* idle task for this cpu          */
    void               *sched_priv;
    struct ac_timer     s_timer;        /* scheduling timer                */
    unsigned long       tick;           /* current periodic 'tick'         */
#ifdef BUCKETS
    u32                 hist[BUCKETS];  /* for scheduler latency histogram */
#endif
} __cacheline_aligned;

struct task_slice {
    struct exec_domain *task;
    s_time_t            time;
};

struct scheduler {
    char *name;             /* full name for this scheduler      */
    char *opt_name;         /* option name for this scheduler    */
    unsigned int sched_id;  /* ID for this scheduler             */

    int          (*alloc_task)     (struct exec_domain *);
    void         (*add_task)       (struct exec_domain *);
    void         (*free_task)      (struct domain *);
    void         (*rem_task)       (struct exec_domain *);
    void         (*sleep)          (struct exec_domain *);
    void         (*wake)           (struct exec_domain *);
    struct task_slice (*do_schedule) (s_time_t);
    int          (*control)        (struct sched_ctl_cmd *);
    int          (*adjdom)         (struct domain *,
                                    struct sched_adjdom_cmd *);
    void         (*dump_settings)  (void);
    void         (*dump_cpu_state) (int);
};

extern struct schedule_data schedule_data[];

#endif /* __XEN_SCHED_IF_H__ */