4 * Userland scheduler API
6 * $DragonFly: src/sys/sys/usched.h,v 1.15 2008/04/21 15:24:47 dillon Exp $
10 #define _SYS_USCHED_H_
12 #if defined(_KERNEL) || defined(_KERNEL_STRUCTURES)
15 #include <sys/types.h>
18 #include <sys/queue.h>
20 #ifndef _SYS_SYSTIMER_H_
21 #include <sys/systimer.h>
24 #define NAME_LENGTH 32
31 TAILQ_ENTRY(usched) entry;
34 void (*usched_register)(void);
35 void (*usched_unregister)(void);
36 void (*acquire_curproc)(struct lwp *);
37 void (*release_curproc)(struct lwp *);
38 void (*setrunqueue)(struct lwp *);
39 void (*schedulerclock)(struct lwp *, sysclock_t, sysclock_t);
40 void (*recalculate)(struct lwp *);
41 void (*resetpriority)(struct lwp *);
42 void (*heuristic_forking)(struct lwp *, struct lwp *);
43 void (*heuristic_exiting)(struct lwp *, struct proc *);
44 void (*uload_update)(struct lwp *);
45 void (*setcpumask)(struct usched *, cpumask_t);
46 void (*yield)(struct lwp *);
47 void (*changedcpu)(struct lwp *);
55 short priority; /* lower is better */
56 char unused01; /* (currently not used) */
58 int batch; /* batch mode heuristic */
59 int estcpu; /* dynamic priority modification */
60 u_short rqtype; /* protected copy of rtprio type */
64 short priority; /* lower is better */
65 char forked; /* lock cpu during fork */
67 short estfast; /* fast estcpu collapse mode */
68 short uload; /* for delta uload adjustments */
69 int estcpu; /* dynamic priority modification */
70 u_short rqtype; /* protected copy of rtprio type */
71 u_short qcpu; /* which cpu are we enqueued on? */
72 u_short rrcount; /* reset when moved to runq tail */
78 int pad[6]; /* PAD for future expansion */
82 * Flags for usched_ctl()
84 #define USCH_ADD 0x00000001
85 #define USCH_REM 0x00000010
87 #endif /* _KERNEL || _KERNEL_STRUCTURES */
89 #define USCHED_SET_SCHEDULER 0
90 #define USCHED_SET_CPU 1
91 #define USCHED_ADD_CPU 2
92 #define USCHED_DEL_CPU 3
93 #define USCHED_GET_CPU 4
96 * Kernel variables and procedures, or user system calls.
100 extern struct usched usched_bsd4;
101 extern struct usched usched_dfly;
102 extern struct usched usched_dummy;
103 extern cpumask_t usched_mastermask;
104 extern int sched_ticks; /* From sys/kern/kern_clock.c */
106 int usched_ctl(struct usched *, int);
107 struct usched *usched_init(void);
108 void usched_schedulerclock(struct lwp *, sysclock_t, sysclock_t);
112 #if !defined(_KERNEL) || defined(_KERNEL_VIRTUAL)
114 int usched_set(pid_t, int, void *, int);