Re: remove VM_LOCKED before remap_pfn_range and drop VM_SHM

From: Hugh Dickins
Date: Wed May 24 2006 - 10:57:58 EST


On Tue, 23 May 2006, Christoph Lameter wrote:
>
> Remove VM_LOCKED before remap_pfn range from device drivers and get rid of
> VM_SHM.

Okay, that is rather a nice cleanup. I've held off from doing it,
and have discouraged one or two others from doing it, because there's
a number of other things to be checked thereabouts (witness the way
vfc_dev.c is or'ing flags it has no business to change: but you've
rightly preserved that existing behaviour for now, however bad it may
be); and there's VM_RESERVED (or most of its or'ings) to be removed too.

But what you have looks nice, and no way does it prevent further
cleanup later; though I've not wanted to bother maintainers repeatedly.

Of course, you don't need this patch in order to proceed with migrating
VM_LOCKED areas, because this patch is no more than a cleanup of
irrelevance. Well, somewhat worse than irrelevance: when a driver
unilaterally sets VM_LOCKED on a vma, then mm->locked_vm goes wild
when the vma is unmapped: doesn't matter at exit, but bad if before.

> remap_pfn_range() already sets VM_IO. There is no need to set VM_SHM since
> it does nothing. VM_LOCKED is of no use since the remap_pfn_range does
> not place pages on the LRU. The pages are therefore never subject to
> swap anyways. Remove all the vm_flags settings before calling
> remap_pfn_range.
>
> After removing all the vm_flag settings no use of VM_SHM is left.
> Drop it.
>
> Signed-off-by: Christoph Lameter <clameter@xxxxxxx>

Acked-by: Hugh Dickins <hugh@xxxxxxxxxxx>
-
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/