From: Joe Simmons-Talbott <josimmon@redhat.com>
To: "Michal Koutný" <mkoutny@suse.com>
Cc: Joe Simmons-Talbott <joest@redhat.com>, Tejun Heo <tj@kernel.org>,
Johannes Weiner <hannes@cmpxchg.org>,
Shuah Khan <shuah@kernel.org>,
cui.tao@linux.dev, Li Wang <li.wang@linux.dev>,
Shakeel Butt <shakeel.butt@linux.dev>,
Nhat Pham <nphamcs@gmail.com>,
Guopeng Zhang <zhangguopeng@kylinos.cn>,
Sebastian Chlad <sebastianchlad@gmail.com>,
"open list:CONTROL GROUP (CGROUP)" <cgroups@vger.kernel.org>,
"open list:KERNEL SELFTEST FRAMEWORK"
<linux-kselftest@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH RESEND v4] selftests/cgroup: Adjust cpu test duration based on HZ
Date: Fri, 26 Jun 2026 16:19:18 -0400 [thread overview]
Message-ID: <20260626201918.GC19617@oak> (raw)
In-Reply-To: <aj6r_tUrPH8eTuQw@localhost.localdomain>
On Fri, Jun 26, 2026 at 06:44:46PM +0200, Michal Koutný wrote:
> On Thu, Jun 25, 2026 at 04:33:04PM -0400, Joe Simmons-Talbott <joest@redhat.com> wrote:
> > static int test_cpucg_max_nested(const char *root)
> > {
> > int ret = KSFT_FAIL;
> > + long hz = get_config_hz();
> > long quota_usec = 1000;
> > long default_period_usec = 100000; /* cpu.max's default period */
> > long duration_seconds = 1;
> >
> > - long duration_usec = duration_seconds * USEC_PER_SEC;
> > + long duration_usec, duration_sec, duration_nsec;
> > long usage_usec, n_periods, remainder_usec, expected_usage_usec;
> > char *parent, *child;
> > char quota_buf[32];
> >
> > + duration_usec = duration_seconds * USEC_PER_SEC * 1000 / hz;
> > + duration_sec = duration_usec / USEC_PER_SEC;
> > + duration_nsec = duration_usec % USEC_PER_SEC * NSEC_PER_USEC;
>
> Oh, that's duration in so many units and the seconds is there twice. (I
> understand why you did that for the rescale but) could you pick more
> descriptive/distinctive names then and ideally keep it simple :-p
Thanks for the feedback. I'll send a v5 with those intermediate
variables removed and do the calculatons where they are used to setup
the cpu hog's time values.
Thanks,
Joe
prev parent reply other threads:[~2026-06-26 20:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-25 20:33 [PATCH RESEND v4] selftests/cgroup: Adjust cpu test duration based on HZ Joe Simmons-Talbott
2026-06-26 16:44 ` Michal Koutný
2026-06-26 20:19 ` Joe Simmons-Talbott [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260626201918.GC19617@oak \
--to=josimmon@redhat.com \
--cc=cgroups@vger.kernel.org \
--cc=cui.tao@linux.dev \
--cc=hannes@cmpxchg.org \
--cc=joest@redhat.com \
--cc=li.wang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=mkoutny@suse.com \
--cc=nphamcs@gmail.com \
--cc=sebastianchlad@gmail.com \
--cc=shakeel.butt@linux.dev \
--cc=shuah@kernel.org \
--cc=tj@kernel.org \
--cc=zhangguopeng@kylinos.cn \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.