• Dmitry Safonov's avatar
    mm/mremap: account memory on do_munmap() failure · 51df7bcb
    Dmitry Safonov authored
    Patch series "mremap: move_vma() fixes".
    
    This patch (of 6):
    
    move_vma() copies VMA without adding it to account, then unmaps old part
    of VMA.  On failure it unmaps the new VMA.  With hacks accounting in
    munmap is disabled as it's a copy of existing VMA.
    
    Account the memory on munmap() failure which was previously copied into
    a new VMA.
    
    Link: https://lkml.kernel.org/r/20201013013416.390574-1-dima@arista.com
    Link: https://lkml.kernel.org/r/20201013013416.390574-2-dima@arista.com
    Fixes: commit e2ea8374 ("[PATCH] mremap: move_vma fixes and cleanup")
    Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
    Cc: Alexander Viro <viro@zeniv.linux.org.uk>
    Cc: Andy Lutomirski <luto@kernel.org>
    Cc: Brian Geffon <bgeffon@google.com>
    Cc: Catalin Marinas <catalin.marinas@arm.com>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Dave Jiang <dave.jiang@intel.com>
    Cc: Hugh Dickins <hughd@google.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Mike Kravetz <mike.kravetz@oracle.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Russell King <linux@armlinux.org.uk>
    Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Vishal Verma <vishal.l.verma@intel.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Will Deacon <will@kernel.org>
    Cc: Dan Carpenter <dan.carpenter@oracle.com>
    Cc: John Hubbard <jhubbard@nvidia.com>
    Cc: Jason Gunthorpe <jgg@ziepe.ca>
    Cc: Ralph Campbell <rcampbell@nvidia.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    51df7bcb
mremap.c 25.6 KB