fedora core 6 1.2949 + vserver 2.2.0
[linux-2.6.git] / include / linux / vserver / sched_def.h
1 #ifndef _VX_SCHED_DEF_H
2 #define _VX_SCHED_DEF_H
3
4 #include <linux/spinlock.h>
5 #include <linux/jiffies.h>
6 #include <linux/cpumask.h>
7 #include <asm/atomic.h>
8 #include <asm/param.h>
9
10
11 /* context sub struct */
12
13 struct _vx_sched {
14         spinlock_t tokens_lock;         /* lock for token bucket */
15
16         int tokens;                     /* number of CPU tokens */
17         int fill_rate[2];               /* Fill rate: add X tokens... */
18         int interval[2];                /* Divisor:   per Y jiffies   */
19         int tokens_min;                 /* Limit:     minimum for unhold */
20         int tokens_max;                 /* Limit:     no more than N tokens */
21
22         int prio_bias;                  /* bias offset for priority */
23
24         unsigned update_mask;           /* which features should be updated */
25         cpumask_t update;               /* CPUs which should update */
26 };
27
28 struct _vx_sched_pc {
29         int tokens;                     /* number of CPU tokens */
30         int flags;                      /* bucket flags */
31
32         int fill_rate[2];               /* Fill rate: add X tokens... */
33         int interval[2];                /* Divisor:   per Y jiffies   */
34         int tokens_min;                 /* Limit:     minimum for unhold */
35         int tokens_max;                 /* Limit:     no more than N tokens */
36
37         int prio_bias;                  /* bias offset for priority */
38         int vavavoom;                   /* last calculated vavavoom */
39
40         unsigned long norm_time;        /* last time accounted */
41         unsigned long idle_time;        /* non linear time for fair sched */
42         unsigned long token_time;       /* token time for accounting */
43         unsigned long onhold;           /* jiffies when put on hold */
44
45         uint64_t user_ticks;            /* token tick events */
46         uint64_t sys_ticks;             /* token tick events */
47         uint64_t hold_ticks;            /* token ticks paused */
48 };
49
50
51 #define VXSF_ONHOLD     0x0001
52 #define VXSF_IDLE_TIME  0x0100
53
54 #ifdef CONFIG_VSERVER_DEBUG
55
56 static inline void __dump_vx_sched(struct _vx_sched *sched)
57 {
58         printk("\t_vx_sched:\n");
59         printk("\t tokens: %4d/%4d, %4d/%4d, %4d, %4d\n",
60                 sched->fill_rate[0], sched->interval[0],
61                 sched->fill_rate[1], sched->interval[1],
62                 sched->tokens_min, sched->tokens_max);
63         printk("\t priority = %4d\n", sched->prio_bias);
64 }
65
66 #endif
67
68 #endif  /* _VX_SCHED_DEF_H */