uint64_t runtime; /* --sched-* options */
uint64_t deadline;
uint64_t period;
+ uint64_t sched_flags; /* For sched_attr->sched_flags member */
unsigned int all_tasks : 1, /* all threads of the PID */
reset_on_fork : 1, /* SCHED_RESET_ON_FORK or SCHED_FLAG_RESET_ON_FORK */
fputs(USAGE_SEPARATOR, out);
fputs(_("Scheduling options:\n"), out);
fputs(_(" -R, --reset-on-fork set reset-on-fork flag\n"), out);
+ fputs(_(" -G, --reclaim-grub set SCHED_FLAG_RECLAIM\n"), out);
fputs(_(" -T, --sched-runtime <ns> runtime parameter for DEADLINE\n"), out);
fputs(_(" -P, --sched-period <ns> period parameter for DEADLINE\n"), out);
fputs(_(" -D, --sched-deadline <ns> deadline parameter for DEADLINE\n"), out);
sa.sched_runtime = ctl->runtime;
sa.sched_period = ctl->period;
sa.sched_deadline = ctl->deadline;
+ sa.sched_flags = ctl->sched_flags;
# ifdef SCHED_FLAG_RESET_ON_FORK
/* Don't use SCHED_RESET_ON_FORK for sched_setattr()! */
{ "sched-period", required_argument, NULL, 'P' },
{ "sched-deadline", required_argument, NULL, 'D' },
{ "reset-on-fork", no_argument, NULL, 'R' },
+ { "reclaim-grub", no_argument, NULL, 'G' },
{ "verbose", no_argument, NULL, 'v' },
{ "version", no_argument, NULL, 'V' },
{ NULL, no_argument, NULL, 0 }
textdomain(PACKAGE);
close_stdout_atexit();
- while((c = getopt_long(argc, argv, "+abdD:efiphmoP:T:rRvV", longopts, NULL)) != -1)
+ while((c = getopt_long(argc, argv, "+abdD:efiphmoP:T:rRGvV", longopts, NULL)) != -1)
{
switch (c) {
case 'a':
case 'R':
ctl->reset_on_fork = 1;
break;
+ case 'G':
+#ifdef SCHED_FLAG_RECLAIM
+ ctl->sched_flags |= SCHED_FLAG_RECLAIM;
+#endif
+ break;
case 'i':
#ifdef SCHED_IDLE
ctl->policy = SCHED_IDLE;
if ((ctl->deadline || ctl->period) && ctl->policy != SCHED_DEADLINE)
errx(EXIT_FAILURE, _("--sched-{deadline,period} options are "
"supported for SCHED_DEADLINE only"));
+# ifdef SCHED_FLAG_RECLAIM
+# ifndef HAVE_SCHED_SETATTR
+ if (ctl->sched_flags & SCHED_FLAG_RECLAIM)
+ errx(EXIT_FAILURE, _("SCHED_FLAG_RECLAIM is unsupported"));
+# endif
+ if ((ctl->sched_flags & SCHED_FLAG_RECLAIM) && ctl->policy != SCHED_DEADLINE)
+ errx(EXIT_FAILURE, _("--reclaim-grub is only supported for SCHED_DEADLINE"));
+# endif
if (ctl->policy == SCHED_DEADLINE) {
/* The basic rule is runtime <= deadline <= period, so we can
* make deadline and runtime optional on command line. Note we
if (ctl->runtime == 0)
ctl->runtime = ctl->deadline;
}
-#else
+#else /* !SCHED_DEADLINE */
if (ctl->deadline || ctl->period)
errx(EXIT_FAILURE, _("SCHED_DEADLINE is unsupported"));
-#endif
+#endif /* SCHED_DEADLINE */
if (ctl->priority < sched_get_priority_min(ctl->policy) ||
sched_get_priority_max(ctl->policy) < ctl->priority)
errx(EXIT_FAILURE,