Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

tools/sched_ext: fix getopt not re-parsed on restart

After goto restart, optind retains its advanced position from the
previous getopt loop, causing getopt() to immediately return -1.
This silently drops all command-line options on the restarted skeleton.

Reset optind to 1 at the restart label so options are re-parsed.

Affected schedulers: scx_simple, scx_central, scx_flatcg, scx_pair,
scx_sdt, scx_cpu0.

Signed-off-by: David Carlier <devnexen@gmail.com>
Signed-off-by: Tejun Heo <tj@kernel.org>

authored by

David Carlier and committed by
Tejun Heo
640c9dc7 f892f9f9

+6
+1
tools/sched_ext/scx_central.c
··· 56 56 signal(SIGINT, sigint_handler); 57 57 signal(SIGTERM, sigint_handler); 58 58 restart: 59 + optind = 1; 59 60 skel = SCX_OPS_OPEN(central_ops, scx_central); 60 61 61 62 skel->rodata->central_cpu = 0;
+1
tools/sched_ext/scx_cpu0.c
··· 69 69 signal(SIGINT, sigint_handler); 70 70 signal(SIGTERM, sigint_handler); 71 71 restart: 72 + optind = 1; 72 73 skel = SCX_OPS_OPEN(cpu0_ops, scx_cpu0); 73 74 74 75 skel->rodata->nr_cpus = libbpf_num_possible_cpus();
+1
tools/sched_ext/scx_flatcg.c
··· 141 141 signal(SIGINT, sigint_handler); 142 142 signal(SIGTERM, sigint_handler); 143 143 restart: 144 + optind = 1; 144 145 skel = SCX_OPS_OPEN(flatcg_ops, scx_flatcg); 145 146 146 147 skel->rodata->nr_cpus = libbpf_num_possible_cpus();
+1
tools/sched_ext/scx_pair.c
··· 53 53 signal(SIGINT, sigint_handler); 54 54 signal(SIGTERM, sigint_handler); 55 55 restart: 56 + optind = 1; 56 57 skel = SCX_OPS_OPEN(pair_ops, scx_pair); 57 58 58 59 skel->rodata->nr_cpu_ids = libbpf_num_possible_cpus();
+1
tools/sched_ext/scx_sdt.c
··· 51 51 signal(SIGINT, sigint_handler); 52 52 signal(SIGTERM, sigint_handler); 53 53 restart: 54 + optind = 1; 54 55 skel = SCX_OPS_OPEN(sdt_ops, scx_sdt); 55 56 56 57 while ((opt = getopt(argc, argv, "fvh")) != -1) {
+1
tools/sched_ext/scx_simple.c
··· 71 71 signal(SIGINT, sigint_handler); 72 72 signal(SIGTERM, sigint_handler); 73 73 restart: 74 + optind = 1; 74 75 skel = SCX_OPS_OPEN(simple_ops, scx_simple); 75 76 76 77 while ((opt = getopt(argc, argv, "fvh")) != -1) {