Unify_unify(): made it work also when destination file does not exist (needed for...
[util-vserver.git] / util-vserver / kernel / sched.h
index c918e36..1054da8 100644 (file)
@@ -63,15 +63,6 @@ static inline int vx_info_proc_sched(struct _vx_sched *sched, char *buffer)
 
 /*  sched vserver commands */
 
-#define VCMD_set_sched_v1      VC_CMD(SYSTEST, 1, 1)
-
-struct  vcmd_set_sched_v1 {
-       int32_t fill_rate;
-       int32_t period;
-       int32_t fill_level;
-       int32_t bucket_size;
-};
-
 #define VCMD_set_sched         VC_CMD(SCHED, 1, 2)
 
 struct  vcmd_set_sched_v2 {
@@ -114,17 +105,26 @@ static inline void vx_consume_token(struct vx_info *vxi)
        atomic_dec(&vxi->sched.tokens);
 }
 
-static inline int vx_need_resched(struct task_struct *p, struct vx_info *vxi)
+static inline int vx_need_resched(struct task_struct *p)
 {
-       p->time_slice--;
+#ifdef CONFIG_VSERVER_HARDCPU
+       struct vx_info *vxi = p->vx_info;
+
        if (vxi) {
                int tokens;
+
+               p->time_slice--;
+               if (atomic_read(&vxi->vx_refcount) < 1)
+                       printk("need_resched: p=%p, s=%ld, ref=%d, id=%d/%d\n",
+                               p, p->state, atomic_read(&vxi->vx_refcount),
+                               vxi->vx_id, p->xid);
                if ((tokens = vx_tokens_avail(vxi)) > 0)
                        vx_consume_token(vxi);
-
                return ((p->time_slice == 0) || (tokens < 1));
-       } else
-               return (p->time_slice == 0);
+       }
+#endif
+       p->time_slice--;
+       return (p->time_slice == 0);
 }