]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit - kernel/fork.c
mm: use helper functions for allocating and freeing vm_area structs
authorLinus Torvalds <torvalds@linux-foundation.org>
Sat, 21 Jul 2018 20:48:51 +0000 (13:48 -0700)
committerJuerg Haefliger <juergh@canonical.com>
Wed, 24 Jul 2019 01:44:17 +0000 (19:44 -0600)
commite88c5cf9e942dbfeb680f1fa290d19e159b4d3c9
tree6f5f5b1dc101272ddc2a4b21d22244059388039d
parent99573423266b7796e98d5656527a85fcaa126f64
mm: use helper functions for allocating and freeing vm_area structs

BugLink: https://bugs.launchpad.net/bugs/1835845
[ Upstream commit 3928d4f5ee37cdc523894f6e549e6aae521d8980 ]

The vm_area_struct is one of the most fundamental memory management
objects, but the management of it is entirely open-coded evertwhere,
ranging from allocation and freeing (using kmem_cache_[z]alloc and
kmem_cache_free) to initializing all the fields.

We want to unify this in order to end up having some unified
initialization of the vmas, and the first step to this is to at least
have basic allocation functions.

Right now those functions are literally just wrappers around the
kmem_cache_*() calls.  This is a purely mechanical conversion:

    # new vma:
    kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL) -> vm_area_alloc()

    # copy old vma
    kmem_cache_alloc(vm_area_cachep, GFP_KERNEL) -> vm_area_dup(old)

    # free vma
    kmem_cache_free(vm_area_cachep, vma) -> vm_area_free(vma)

to the point where the old vma passed in to the vm_area_dup() function
isn't even used yet (because I've left all the old manual initialization
alone).

Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
arch/ia64/kernel/perfmon.c
arch/ia64/mm/init.c
fs/exec.c
include/linux/mm.h
kernel/fork.c
mm/mmap.c
mm/nommu.c