From: "Paul E. McKenney" <paulmck@kernel.org>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Andrew Morton <akpm@linux-foundation.org>,
Roman Gushchin <roman.gushchin@linux.dev>,
Michal Hocko <mhocko@suse.com>,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org,
cgroups@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] selftests: cgroup: fix test_kmem_basic false positives
Date: Tue, 1 Aug 2023 09:39:28 -0700 [thread overview]
Message-ID: <c40ca485-f52e-411a-9f33-3adabc53c0fc@paulmck-laptop> (raw)
In-Reply-To: <20230801135632.1768830-1-hannes@cmpxchg.org>
On Tue, Aug 01, 2023 at 09:56:32AM -0400, Johannes Weiner wrote:
> This test fails routinely in our prod testing environment, and I can
> reproduce it locally as well.
>
> The test allocates dcache inside a cgroup, then drops the memory limit
> and checks that usage drops correspondingly. The reason it fails is
> because dentries are freed with an RCU delay - a debugging sleep shows
> that usage drops as expected shortly after.
>
> Insert a 1s sleep after dropping the limit. This should be good
> enough, assuming that machines running those tests are otherwise not
> very busy.
>
> Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
I am putting together something more formal, but this will certainly
improve things, as Johannes says, assuming the system goes mostly
idle during that one-second wait. So:
Acked-by: Paul E. McKenney <paulmck@kernel.org>
Yes, there are corner cases, such as the system having millions of
RCU callbacks queued and being unable to invoke them all during that
one-second interval. But that is a corner case, and that is exactly
why I will be putting together something more formal. ;-)
Thanx, Paul
> ---
> tools/testing/selftests/cgroup/test_kmem.c | 4 ++++
> 1 file changed, 4 insertions(+)
>
> diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c
> index 258ddc565deb..1b2cec9d18a4 100644
> --- a/tools/testing/selftests/cgroup/test_kmem.c
> +++ b/tools/testing/selftests/cgroup/test_kmem.c
> @@ -70,6 +70,10 @@ static int test_kmem_basic(const char *root)
> goto cleanup;
>
> cg_write(cg, "memory.high", "1M");
> +
> + /* wait for RCU freeing */
> + sleep(1);
> +
> slab1 = cg_read_key_long(cg, "memory.stat", "slab ");
> if (slab1 <= 0)
> goto cleanup;
> --
> 2.41.0
>
next prev parent reply other threads:[~2023-08-01 17:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-01 13:56 Johannes Weiner
2023-08-01 16:39 ` Paul E. McKenney [this message]
2023-08-03 16:13 ` Lucas Karpinski
2023-08-03 17:19 ` Paul E. McKenney
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=c40ca485-f52e-411a-9f33-3adabc53c0fc@paulmck-laptop \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=cgroups@vger.kernel.org \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mhocko@suse.com \
--cc=roman.gushchin@linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox