On 3/19/22 12:23 AM, Gabriel Krisman Bertazi wrote:
+static void test_vma_reuse(int pagemap_fd, int pagesize) +{
- char *map, *map2;
- map = mmap(NULL, pagesize, (PROT_READ | PROT_WRITE), (MAP_PRIVATE | MAP_ANON), -1, 0);
- if (map == MAP_FAILED)
ksft_exit_fail_msg("mmap failed");
- clear_softdirty();
- /* Write to the page before unmapping and map the same size region again to check
* if same memory region is gotten next time and if dirty bit is preserved across
* this type of allocations.
*/
This reads weird. It should *not* be preserved across different mappings. Also, we are not testing if the same region is reused, we are depending on it to test the sd bit.
/* Ensures the soft-dirty bit is reset accross different mappings on the same address. */
Soft dirty bit is always set for new regions (reused or not). I'll correct the comment and improve this sub test.