From: "Michal Koutný" <mkoutny@suse.com>
To: Joe Simmons-Talbott <joest@redhat.com>
Cc: 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 18:44:46 +0200 [thread overview]
Message-ID: <aj6r_tUrPH8eTuQw@localhost.localdomain> (raw)
In-Reply-To: <20260625203307.1114538-1-joest@redhat.com>
[-- Attachment #1: Type: text/plain, Size: 999 bytes --]
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,
Michal
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 265 bytes --]
next prev parent reply other threads:[~2026-06-26 16:44 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ý [this message]
2026-06-26 20:19 ` Joe Simmons-Talbott
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=aj6r_tUrPH8eTuQw@localhost.localdomain \
--to=mkoutny@suse.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=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.