Re: [PATCH v2] [PATCH RESEND] mm/selftest: Replace static BASE_PMD_ADDR with dynamic address allocation

Peter Xu
2025-03-19T14:10:37Z

On Tue, Mar 18, 2025 at 10:35:33PM -0400, Marty Kareem wrote:
> Hi Peter,

Marty,

>
> Thank you for your detailed review and suggestions.
>
> I've updated the patch to address the race condition you highlighted. In this v2 patch, the following changes have been made:
>
> 1. The PROT_NONE reservation is maintained until it can be atomically replaced.
>
> 2. I now use MAP_FIXED to atomically replace the reservation with the intended mapping.
>
> 3. The MAP_FIXED_NOREPLACE conditionals have been removed, as the atomic replacement works reliably across all kernel versions.
>
> 4. The overall implementation has been simplified while ensuring robustness.

All look good here, thanks.

>
> These modifications ensure that the memory region remains reserved until it is atomically replaced, effectively eliminating the race window and improving test reliability—especially in parallel test environments. Benchmark results show only a minimal performance impact (approximately 1.3x overhead vs. static addressing), and all tests pass successfully.
>
> One note: I'm currently having some issues with git send-email and my Outlook account, so I'm sending this patch through Thunderbird as a plain text attachment. I’m working on resolving the git send-email setup for future submissions.

If your intention is to try working on something on Linux, let's try to fix
this. Using attachment is not the normal workflow, so you'll need it
sooner or later.

I bet now with all the AI stuff recently, it shouldn't be hard to ask and
get something to try even without asking on the list, AI should be able to
look at your specific issue.

Then please send your v2 formally with git send-email. You can start
testing that with sending to yourself of course.

Good luck,

--
Peter Xu