Re: [1/1] mm: thp: calculate the mapcount correctly for THP pages during WP faults

From: Mike Marciniszyn
Date: Wed May 11 2016 - 17:26:23 EST



Reviewed-by: "Kirill A. Shutemov" <kirill@xxxxxxxxxxxxx>
Signed-off-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>


Our RDMA tests are seeing an issue with memory locking that bisects to
commit 61f5d698cc97 ("mm: re-enable THP").

The test program registers two rather large MRs (512M) and RDMA writes
data to a passive peer using the first and RDMA reads it back into the
second MR and compares that data. The sizes are chosen randomly between
0 and 1024 bytes.

The test will get through a few (<= 4 iterations) and then gets a compare error.

Tracing indicates the kernel logical addresses associated with the individual
pages at registration ARE correct , the data in the "RDMA read response only"
packets ARE correct.

The âcorruptionâ occurs when the packet crosse two pages that are not
physically contiguous. The second page reads back as zero in the program.

It looks like the user VA at the point of the compare error no longer points
to the same physical address as was registered.
This patch totally resolves the issue!

Tested-by: Mike Marciniszyn <mike.marciniszy@xxxxxxxxx>
Tested-by: Josh Collier <josh.d.collier@xxxxxxxxx>