Re: Nick's core remove PageReserved broke vmware...

From: Hugh Dickins
Date: Thu Nov 10 2005 - 08:16:48 EST


On Thu, 10 Nov 2005, Michael S. Tsirkin wrote:
> Quoting Gleb Natapov <gleb@xxxxxxxxxxxxx>:
> > I think you are removing VM_RAND_READ/VM_SEQ_READ here.

Good catch from Gleb, I certainly didn't notice that.
>
> True, we need something like
>
> switch (behavior) {
> case MADV_SEQUENTIAL:
> new_flags = (vma->vm_flags & ~VM_READHINTMASK) | VM_SEQ_READ;
> break;
> case MADV_RANDOM:
> new_flags = (vma->vm_flags & ~VM_READHINTMASK) | VM_RAND_READ;
> break;

Yes, that helps avoid such errors in future. Though, no strong feelings,
but I'd find it clearer to avoid the obscure VM_READHINTMASK completely,
and just say (vma->vm_flags & ~VM_RAND_READ) | VM_SEQ_READ etc.

Hugh
-
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/