• Peter Xu's avatar
    hugetlb: do early cow when page pinned on src mm · 4eae4efa
    Peter Xu authored
    This is the last missing piece of the COW-during-fork effort when there're
    pinned pages found.  One can reference 70e806e4 ("mm: Do early cow for
    pinned pages during fork() for ptes", 2020-09-27) for more information,
    since we do similar things here rather than pte this time, but just for
    hugetlb.
    
    Note that after Jason's recent work on 57efa1fe ("mm/gup: prevent
    gup_fast from racing with COW during fork", 2020-12-15) which is safer and
    easier to understand, we're safe now within the whole copy_page_range()
    against gup-fast, we don't need the wr-protect trick that proposed in
    70e806e4 anymore.
    
    Link: https://lkml.kernel.org/r/20210217233547.93892-6-peterx@redhat.comSigned-off-by: default avatarPeter Xu <peterx@redhat.com>
    Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
    Reviewed-by: default avatarJason Gunthorpe <jgg@ziepe.ca>
    Cc: Alexey Dobriyan <adobriyan@gmail.com>
    Cc: Andrea Arcangeli <aarcange@redhat.com>
    Cc: Christoph Hellwig <hch@lst.de>
    Cc: Daniel Vetter <daniel@ffwll.ch>
    Cc: David Airlie <airlied@linux.ie>
    Cc: David Gibson <david@gibson.dropbear.id.au>
    Cc: Gal Pressman <galpress@amazon.com>
    Cc: Jan Kara <jack@suse.cz>
    Cc: Jann Horn <jannh@google.com>
    Cc: Kirill Shutemov <kirill@shutemov.name>
    Cc: Kirill Tkhai <ktkhai@virtuozzo.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Miaohe Lin <linmiaohe@huawei.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Roland Scheidegger <sroland@vmware.com>
    Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
    Cc: Wei Zhang <wzam@amazon.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    4eae4efa
hugetlb.c 157 KB