Admit Real-Time Tasks
The final step before the plugin can be used to schedule real-time tasks, we are going to change to demo_admit_task() callback to allow tasks, provided that they are located on the right core.
To this end, change demo_admit_task() to look as follows:
Since DEMO implements a partitioned scheduler, we require that real-time tasks have migrated to the appropriated core before they become real-time tasks. This constraint simplifies the implementation of the plugin greatly and is not difficult to support in userspace (liblitmus contains a helper function be_migrate_to() that can take care of this requirement).
Note that task_cpu(tsk) is Linux's notion of where the task currently is, whereas get_partition(tsk) is LITMUSRT's notion of where the task is (logically) assigned to.
Testing
With this change in place, the plugin should be fully functional.
- Compile and boot the kernel
Select the DEMO plugin with setsched.
Launch some real-time tasks (e.g., with rtspin or rt_launch, which are both part of liblitmus).