12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576 |
- #include "sched.h"
- #include <common/kprint.h>
- #include <common/spinlock.h>
- #include <driver/video/video.h>
- #include <sched/cfs.h>
- #include <common/string.h>
- static int __sched_setscheduler(struct process_control_block *p, const struct sched_attr *attr, bool user, bool pi)
- {
- int policy = attr->sched_policy;
- recheck:;
-
- if (!IS_VALID_SCHED_POLICY(policy))
- {
- return -EINVAL;
- }
-
- p->policy = policy;
- return 0;
- }
- static int _sched_setscheduler(struct process_control_block *p, int policy, const struct sched_param *param, bool check)
- {
- struct sched_attr attr = {.sched_policy = policy};
- return __sched_setscheduler(p, &attr, check, true);
- }
- int sched_setscheduler(struct process_control_block *p, int policy, const struct sched_param *param)
- {
- return _sched_setscheduler(p, policy, param, true);
- }
- void sched_enqueue(struct process_control_block *pcb)
- {
- sched_cfs_enqueue(pcb);
- }
- void sched()
- {
- sched_cfs();
- }
- void sched_init()
- {
- sched_cfs_init();
- }
|