Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion doc/tutorial.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,7 @@ otherwise the scheduling parameters will stay unchanged
* policy : String. Define the scheduling policy of the thread. default_policy
is used if not defined. Accepted value are:
- "SCHED_OTHER"
- "SCHED_BATCH"
- "SCHED_IDLE"
- "SCHED_RR"
- "SCHED_FIFO"
Expand Down Expand Up @@ -329,7 +330,8 @@ and don't do anything otherwise.
*** taskgroups

* taskgroup: String. Can be specified at task level or phase level. Currently
only SCHED_OTHER and SCHED_IDLE tasks are supported to contain taskgroup data.
only SCHED_OTHER, SCHED_BATCH and SCHED_IDLE tasks are supported to contain
taskgroup data.
Tasks with a different policy and without taskgroup data can coexist in the
setup. An empty taskgroup ("") is allowed and is interpreted as if there is
no taskgroup data given. Pre-existing parts of a taskgroup are preserved.
Expand Down
5 changes: 3 additions & 2 deletions src/rt-app.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ static void __set_thread_sched_other_attrs(thread_data_t *data,

tid = gettid();
sa_params.size = sizeof(struct sched_attr);
sa_params.sched_policy = SCHED_OTHER;
sa_params.sched_policy = sched_data->policy;
sa_params.sched_priority = __sched_priority(data, sched_data);
/* In the CFS case, sched_data->prio is the NICE value. */
sa_params.sched_nice = sched_data->prio;
Expand Down Expand Up @@ -1008,7 +1008,7 @@ static void _set_thread_cfs(thread_data_t *data, sched_data_t *sched_data)
(sched_data->policy != data->curr_sched_data->policy))
__set_thread_policy_priority(data, sched_data);

if (sched_data->policy == other)
if (sched_data->policy == other || sched_data->policy == batch)
__set_thread_sched_other_attrs(data, sched_data);

__log_policy_priority_change(data, sched_data);
Expand Down Expand Up @@ -1127,6 +1127,7 @@ static void set_thread_param(thread_data_t *data, sched_data_t *sched_data)
_set_thread_uclamp(data, sched_data);
break;
case other:
case batch:
case idle:
_set_thread_cfs(data, sched_data);
_set_thread_uclamp(data, sched_data);
Expand Down
7 changes: 4 additions & 3 deletions src/rt-app_parse_config.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ static sched_data_t *parse_sched_data(struct json_object *obj, int def_policy)
prior_def = THREAD_PRIORITY_UNCHANGED;
break;
case other:
case batch:
case idle:
prior_def = DEFAULT_THREAD_NICE;
break;
Expand Down Expand Up @@ -960,13 +961,13 @@ static void check_taskgroup_policy_dep(phase_data_t *pdata, thread_data_t *tdata

/*
* Detect policy/taskgroup misconfiguration: a task which specifies a
* taskgroup should not run in a policy other than SCHED_OTHER or
* SCHED_IDLE.
* taskgroup should not run in a policy other than SCHED_OTHER,
* SCHED_BATCH, or SCHED_IDLE.
*/
if (tdata->curr_sched_data && tdata->curr_taskgroup_data) {
policy_t policy = tdata->curr_sched_data->policy;

if (policy != other && policy != idle) {
if (policy != other && policy != batch && policy != idle) {
log_critical(PIN2 "No taskgroup support for policy %s",
policy_to_string(policy));
exit(EXIT_INV_CONFIG);
Expand Down
4 changes: 3 additions & 1 deletion src/rt-app_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#define EXIT_INV_CONFIG 2
#define EXIT_INV_COMMANDLINE 3

/* SCHED_IDLE is not available if __USE_GNU is not defined */
/* SCHED_BATCH and SCHED_IDLE are not available if __USE_GNU is not defined */
#ifndef __USE_GNU
#define SCHED_BATCH 3
#define SCHED_IDLE 5
#endif

Expand All @@ -65,6 +66,7 @@ struct _thread_data_t;
typedef enum policy_t
{
other = SCHED_OTHER,
batch = SCHED_BATCH,
idle = SCHED_IDLE,
rr = SCHED_RR,
fifo = SCHED_FIFO,
Expand Down
4 changes: 4 additions & 0 deletions src/rt-app_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,8 @@ string_to_policy(const char *policy_name, policy_t *policy)
{
if (strcmp(policy_name, "SCHED_OTHER") == 0)
*policy = other;
else if (strcmp(policy_name, "SCHED_BATCH") == 0)
*policy = batch;
else if (strcmp(policy_name, "SCHED_IDLE") == 0)
*policy = idle;
else if (strcmp(policy_name, "SCHED_RR") == 0)
Expand All @@ -195,6 +197,8 @@ policy_to_string(policy_t policy)
switch (policy) {
case other:
return "SCHED_OTHER";
case batch:
return "SCHED_BATCH";
case idle:
return "SCHED_IDLE";
case rr:
Expand Down