[LTP] [PATCH v1] starvation.c: New case for sched starvation
Wei Gao
wegao@suse.com
Tue May 9 15:56:43 CEST 2023
On Tue, May 09, 2023 at 07:52:56AM +0200, Petr Vorel wrote:
> > On Fri, May 05, 2023 at 07:31:37PM +0200, Petr Vorel wrote:
> > > Hi Wei,
>
> > > > +static struct tst_test test = {
> > > > + .test_all = do_test,
> > > > + .setup = setup,
> > > > + .forks_child = 1,
> > > > + .needs_checkpoints = 1,
> > > > + .max_runtime = 120,
> > > Are you sure 2 min is enough? Maybe we need to use tst_remaining_runtime() to
> > > check if we're not running out of time.
>
> > Seems difficult to check with tst_remaining_runtime since i can use code such as:
> > while(tst_remaining_runtime())
> > wait_for_pid();
>
> If you don't know how to use tst_remaining_runtime() how about getting
> inspiration from lib/newlib_tests/test_runtime01.c ?
What i mean is i can not use while or do loop to check tst_remaining_runtime, since
the last function wait_for_pid() already hold(block) the current process and you do not need
and can not use tst_remaining_runtime(). Sorry if any misunderstood.
>
> static void run(void)
> {
> int runtime;
>
> tst_res(TINFO, "...");
>
> do {
> runtime = tst_remaining_runtime();
> tst_res(TINFO, "Remaining runtime %d", runtime);
> sleep(1);
> } while (runtime);
>
> tst_res(TPASS, "Test passed");
> }
>
> static struct tst_test test = {
> .test_all = run,
> .max_runtime = 120,
> };
>
> => Also, it's a question, how long should the test be running.
> Is it worth to be running for 2 mins? It's kind of stress test, right?
> But even that wouldn't be 30 sec enough?
Normally the default value which i set will spend ~30s i test in virtual machine.
I suppose 2mins max_runtime should be safe enough.
Yes it can be taken as stress test, you need a big loop number to let test run.
In latest v2 patch the number of loop and max_runtime both configurable, so if your machine
is too slow maybe you need adjust parameter.
>
> Kind regards,
> Petr
>
> > > Also, if we set getopt to choose number of options, we'd need to adjust it by
> > > tst_set_max_runtime().
>
> > > Kind regards,
> > > Petr
>
> > > > +};
More information about the ltp
mailing list