Re: [PATCH] VMA comment fixes

From: Linus Torvalds
Date: Sat Aug 16 2008 - 13:45:46 EST




On Sat, 16 Aug 2008, Ulrich Drepper wrote:
>
> These seem to be two tiny problems in comments related to VMA data
> structures. Am I correct?

No.

> diff --git a/include/linux/mm_types.h b/include/linux/mm_types.h
> - unsigned long vm_flags; /* Flags, listed below. */
> + unsigned long vm_flags; /* Flags, see vmalloc.h. */

It's "see mm.h" for the primary one. The vmalloc.h ones are only used for
vmalloc'ed areas, no for regular _user_ mappings.

That said, I agree that it's damn confusing that we have two different
sets of flags, both called VM_xyz. We use the "vm_area_struct" for the
normal user virtual mappings (mmap) tracking, and we use the "vm_struct"
for the kernel virtual mappings (vmalloc).

Both have a flags field, and both use VM_xyz for their field names.

> diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
> -/* bits in vm_struct->flags */
> +/* bits in vm_area_struct->flags */

See above. The vmalloc ones really are in "vm_struct->flags".

The confusion comes at least partly because

- I think historically we _used_ to use vm_area_struct for both, if I
recall correctly

and because

- we actually have some mixing of the two (for example
"remap_vmalloc_range()" will remap a vmalloc mapping _into_ a user
mapping, so it takes a _user_ mapping (a "vm_area_struct") _and_ a
vmalloc address (internally using a "struct vm_struct") and copies from
one to the other.

it might be a good idea to call the vmalloc flags somethign else than
VM_xyz. But I'm not sure it's worth the churn. I don't remember there
having ever been any _actual_ confusion by the VM people who have to deal
with both (because you really very seldom can confuse them).

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/