From: Mark Brown <broonie@kernel.org>
To: wang lian <lianux.mm@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
SeongJae Park <sj@kernel.org>,
Lorenzo Stoakes <lorenzo.stoakes@oracle.com>,
Zi Yan <ziy@nvidia.com>,
linux-kernel@vger.kernel.org,
Christian Brauner <brauner@kernel.org>,
Jann Horn <jannh@google.com>,
Liam Howlett <Liam.Howlett@oracle.com>,
Shuah Khan <shuah@kernel.org>, Vlastimil Babka <vbabka@suse.cz>,
gkwang <gkwang@linx-info.com>, p1ucky0923 <p1ucky0923@gmail.com>,
ryncsn <ryncsn@gmail.com>,
"zijing . zhang" <zijing.zhang@proton.me>,
linux-kselftest@vger.kernel.org, linux-mm@kvack.org
Subject: Re: [PATCH v5] selftests/mm: add process_madvise() tests
Date: Mon, 14 Jul 2025 14:28:50 +0100 [thread overview]
Message-ID: <b01d1d06-9d7c-4081-b3e3-c2c0fea06fad@sirena.org.uk> (raw)
In-Reply-To: <20250714122533.3135-1-lianux.mm@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1131 bytes --]
On Mon, Jul 14, 2025 at 08:25:33PM +0800, wang lian wrote:
> +TEST_F(process_madvise, remote_collapse)
> +{
> + self->child_pid = fork();
> + ASSERT_NE(self->child_pid, -1);
> + ret = read(pipe_info[0], &info, sizeof(info));
> + if (ret <= 0) {
> + waitpid(self->child_pid, NULL, 0);
> + SKIP(return, "Failed to read child info from pipe.\n");
> + }
> + ASSERT_EQ(ret, sizeof(info));
> +cleanup:
> + /* Cleanup */
> + kill(self->child_pid, SIGKILL);
> + waitpid(self->child_pid, NULL, 0);
> + if (pidfd >= 0)
> + close(pidfd);
The cleanup here won't get run if we skip or assert, skipping will
return immediately (you could replace the return with a 'goto cleanup')
and the asserts will exit the test immediately. This will mean we leak
the child. This isn't an issue for things that are memory mapped or
tracked with file descriptors, the harness will for a new child for each
test so anything that's cleaned up with the process will be handled, but
that doesn't apply to child processes.
I think doing the child setup in a fixture should DTRT but I haven't
gone through in full detail to verify that this is the case.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
next prev parent reply other threads:[~2025-07-14 13:29 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-14 12:25 [PATCH v5] selftests/mm: add process_madvise() tests wang lian
2025-07-14 13:28 ` Mark Brown [this message]
2025-07-15 10:58 ` wang lian
2025-07-15 12:12 ` Mark Brown
2025-07-16 11:13 ` wang lian
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=b01d1d06-9d7c-4081-b3e3-c2c0fea06fad@sirena.org.uk \
--to=broonie@kernel.org \
--cc=Liam.Howlett@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=david@redhat.com \
--cc=gkwang@linx-info.com \
--cc=jannh@google.com \
--cc=lianux.mm@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=lorenzo.stoakes@oracle.com \
--cc=p1ucky0923@gmail.com \
--cc=ryncsn@gmail.com \
--cc=shuah@kernel.org \
--cc=sj@kernel.org \
--cc=vbabka@suse.cz \
--cc=zijing.zhang@proton.me \
--cc=ziy@nvidia.com \
/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;
as well as URLs for NNTP newsgroup(s).