[LTP] [PATCH] getrusage03: Forcing context switches to update resource usage
Li Wang
liwang@redhat.com
Wed Sep 18 05:19:25 CEST 2024
On Tue, Sep 17, 2024 at 7:18 PM Cyril Hrubis <chrubis@suse.cz> wrote:
> Hi!
> > Our CI sporadically complains that this test grandchild's MAXRSS did not
> reach
> > the expected 300MB size.
> >
> > 12 getrusage03.c:86: TFAIL: child.children = 258048, expected 307200
> >
> > As the ru_maxrss value is generally updated at certain intervals or under
> > specific conditions, such as page faults or context switches. There may
> be
> > delay between the completion of memset() and the update of ru_maxrss.
> >
> > To address this issue, we create a function to force context switches by
> > calling sched_yield() multiple times. This approach helps to ensure that
> > the system has the opportunity to update the ru_maxrss value more
> promptly.
> >
> > Reproted-by: Scott Weaver <scweaver@redhat.com>
> > Signed-off-by: Li Wang <liwang@redhat.com>
>
> This looks forgotten but should probably go in before the release...
>
> Anyways:
>
> Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
>
Thank you, patch pushed.
The worth to say that I created the separated function
force_context_switches
to accept an argument for setting context switch times, because I think
maybe
other tests also need that, so in the future if we catch something failure
like
ru_maxrss updating issue, we could move this function to LTP library.
--
Regards,
Li Wang
More information about the ltp
mailing list