diff --git a/sched/sched/sched_setparam.c b/sched/sched/sched_setparam.c index 42bfe06303..fa355c884a 100644 --- a/sched/sched/sched_setparam.c +++ b/sched/sched/sched_setparam.c @@ -163,8 +163,15 @@ int sched_setparam(pid_t pid, FAR const struct sched_param *param) /* The replenishment period must be greater than or equal to the * budget period. */ +#if 1 + /* REVISIT: In the current implementation, the budget cannot exceed + * half the duty. + */ + if (repl_ticks < (2 * budget_ticks)) +#else if (repl_ticks < budget_ticks) +#endif { errcode = EINVAL; goto errout_with_lock; diff --git a/sched/sched/sched_setscheduler.c b/sched/sched/sched_setscheduler.c index 34c5750939..841d9eb165 100644 --- a/sched/sched/sched_setscheduler.c +++ b/sched/sched/sched_setscheduler.c @@ -209,8 +209,15 @@ int sched_setscheduler(pid_t pid, int policy, /* The replenishment period must be greater than or equal to the * budget period. */ +#if 1 + /* REVISIT: In the current implementation, the budget cannot + * exceed half the duty. + */ + if (repl_ticks < (2 * budget_ticks)) +#else if (repl_ticks < budget_ticks) +#endif { errcode = EINVAL; goto errout_with_irq;