Re: [PATCH 2/4] mm: migrate: Close race between migration completion and mprotect

From: Linus Torvalds
Date: Thu Oct 02 2014 - 12:42:00 EST


On Thu, Oct 2, 2014 at 6:29 AM, Mel Gorman <mgorman@xxxxxxx> wrote:
> +
> + /* Recheck VMA as permissions can change during migration started */
> + if (is_write_migration_entry(entry) && (vma->vm_flags & (VM_WRITE)))
> pte = pte_mkwrite(pte);

Side note: we have a "maybe_mkwrite()" helper for the VM_WRITE testing
case. So I'd almost do this as

if (is_write_migration_entry(entry))
pte = maybe_mkwrite(pte, vma);

instead.

Linus
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/