From: Joshua Hahn <joshua.hahnjy@gmail.com>
To: Suresh K C <suresh.k.chandrappa@gmail.com>
Cc: nphamcs@gmail.com, hannes@cmpxchg.org, joshua.hahnjy@gmail.com,
shuah@kernel.org, linux-mm@kvack.org,
linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 1/2] selftests: cachestat: add tests for mmap
Date: Mon, 7 Jul 2025 14:26:02 -0700 [thread overview]
Message-ID: <20250707212603.992104-1-joshua.hahnjy@gmail.com> (raw)
In-Reply-To: <20250707152557.49877-1-suresh.k.chandrappa@gmail.com>
On Mon, 7 Jul 2025 20:55:56 +0530 Suresh K C <suresh.k.chandrappa@gmail.com> wrote:
> From: Suresh K C <suresh.k.chandrappa@gmail.com>
>
> Add a test case to verify cachestat behavior with memory-mapped files
> using mmap(). This ensures that pages accessed via mmap are correctly
> accounted for in the page cache.
>
> Tested on x86_64 with default kernel config
Hey Suresh,
Thanks for the second version with the updates, sorry that I missed the
first time you sent this patch.
[...snip...]
> if (fd < 0) {
> - ksft_print_msg("Unable to create shmem file.\n");
> + ksft_print_msg("Unable to create file.\n");
NIT: I saw that you change this in the second part of the patch. However, why
not just include it in this patch? I feel that it would be good practice
to keep the kerenl in a "correct" state, even in between patches belonging
to the same series. If someone were to just apply this patch but not the
next (however unlikely that is), then they will not see the description of
what file type they failed to create. Just my 2c, no need to change this if
you don't think this is important.
[...snip...]
> + if (type == FILE_MMAP){
> + char *map = mmap(NULL, filesize, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
> + if (map == MAP_FAILED) {
> + ksft_print_msg("mmap failed.\n");
> + ret = false;
> + goto close_fd;
> + }
> + for (int i = 0; i < filesize; i++) {
> + map[i] = 'A';
> + }
> + map[filesize - 1] = 'X';
NIT: Likewise, I don't know if there is a good reason to include this, only to
remove it in the second patch. Perhaps it would be best to just remove it
in this patch, so you don't have to delete it later?
Please let me know what you think. Have a great day!
Joshua
Sent using hkml (https://github.com/sjp38/hackermail)
next prev parent reply other threads:[~2025-07-07 21:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-07 15:25 Suresh K C
2025-07-07 15:25 ` [PATCH v2 2/2] selftest: improve mmap test clarity Suresh K C
2025-07-07 21:26 ` Joshua Hahn [this message]
2025-07-08 17:43 ` [PATCH v2 1/2] selftests: cachestat: add tests for mmap Suresh Chandrappa
2025-07-09 17:03 ` Joshua Hahn
2025-07-09 17:12 ` Suresh Chandrappa
-- strict thread matches above, loose matches on Subject: below --
2025-07-01 18:49 Suresh K C
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=20250707212603.992104-1-joshua.hahnjy@gmail.com \
--to=joshua.hahnjy@gmail.com \
--cc=hannes@cmpxchg.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=nphamcs@gmail.com \
--cc=shuah@kernel.org \
--cc=suresh.k.chandrappa@gmail.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