From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A7A49C433DB for ; Tue, 9 Feb 2021 17:54:27 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2BADC64EC8 for ; Tue, 9 Feb 2021 17:54:27 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2BADC64EC8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=ziepe.ca Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id AE1B86B0070; Tue, 9 Feb 2021 12:54:26 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A90C26B0071; Tue, 9 Feb 2021 12:54:26 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A7686B0072; Tue, 9 Feb 2021 12:54:26 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0244.hostedemail.com [216.40.44.244]) by kanga.kvack.org (Postfix) with ESMTP id 84AFB6B0070 for ; Tue, 9 Feb 2021 12:54:26 -0500 (EST) Received: from smtpin05.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 43BF71858212A for ; Tue, 9 Feb 2021 17:54:26 +0000 (UTC) X-FDA: 77799478932.05.knot52_280408227609 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin05.hostedemail.com (Postfix) with ESMTP id 2D93418580E19 for ; Tue, 9 Feb 2021 17:54:26 +0000 (UTC) X-HE-Tag: knot52_280408227609 X-Filterd-Recvd-Size: 4715 Received: from mail-qk1-f181.google.com (mail-qk1-f181.google.com [209.85.222.181]) by imf23.hostedemail.com (Postfix) with ESMTP for ; Tue, 9 Feb 2021 17:54:25 +0000 (UTC) Received: by mail-qk1-f181.google.com with SMTP id r77so18786204qka.12 for ; Tue, 09 Feb 2021 09:54:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ziepe.ca; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=9+ng8YEwm0gPQtsRFld/mxm+Fr3CGlj9BZPkVB+K7CI=; b=SiiYWvq3kwM29M+A2s0UXd+EpWKLGodGENnjAWHjohMWHEIh3DjSHs3auOIhTEh3fE 5UHtKScTQfiwGlHM5fOgxhKO5M3b+b7ylOleFCcD48y890/RMY5DyJOB8i72VUF0hvxZ x3Vp4GqLvuDgLfJF1ly0h7A8UAtWpUP1lpYiAPheNmFHkk1hy2NaJRH0ilwAzkookv+N nzs7c3o/i8Qgdcw9MakcDzQdks8sLyrvDE8C4o3CzZbnHPMk2FVprTRYqA+Mifl2eVe9 f8zZ4tVf/NnXpkqSuhC9QBISa3prfl6jxo61qOMa3rQfDm8ocUrhpqdCEL+P7meiZSZ5 3PSg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=9+ng8YEwm0gPQtsRFld/mxm+Fr3CGlj9BZPkVB+K7CI=; b=k41zx6UQDxaPEvvHADGzeM5xayUe4Ngep/8OokYMsxoeOQ9YwRfauC87No2NYFKaNk bUURgKD5acBejMZT5qmOhUiEOazz2UO/vBtZanRMR+gslM5OyiorjxDAeTjez4G+Bcak PppsmDbdJ/zD3wtAwHHP7vL9FNdT+CoeaWohJuhuFSBWxrJvbRvGK7f+i2dGkC0AF0jG rbTORKhW+q/r4vOBnusdfoX4IjpsM6SoF/VkJJ/fVqfBcQJagohD9y8Vmul/OZ2Vdli3 M+jq5LNNt4UhRHyJ4pUmqGgLklDYT9S0HALcC+DjPFV+w/Of6rNspTPMg1jM7TJj8RlJ SNkA== X-Gm-Message-State: AOAM533EdSKlEwFpldkAHYTe2GkfhrYLJ4c8YffIZPiZ8rzSZ2a8e7+G ionElOsK1QPAduGgqh4KI6WytQ== X-Google-Smtp-Source: ABdhPJz/ygAfORSfsYQ9FwLVeqQLrsveP/Z/O4JB/psB2/yW/3QE/X3GV64Xufljyk3tGqL8vgtMMg== X-Received: by 2002:a37:4394:: with SMTP id q142mr22152586qka.113.1612893265097; Tue, 09 Feb 2021 09:54:25 -0800 (PST) Received: from ziepe.ca (hlfxns017vw-142-162-115-133.dhcp-dynamic.fibreop.ns.bellaliant.net. [142.162.115.133]) by smtp.gmail.com with ESMTPSA id z25sm7111539qkz.33.2021.02.09.09.54.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Feb 2021 09:54:24 -0800 (PST) Received: from jgg by mlx with local (Exim 4.94) (envelope-from ) id 1l9XDU-005XYP-5F; Tue, 09 Feb 2021 13:54:24 -0400 Date: Tue, 9 Feb 2021 13:54:24 -0400 From: Jason Gunthorpe To: Peter Xu Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Matthew Wilcox , Linus Torvalds , Kirill Tkhai , Mike Rapoport , David Gibson , Kirill Shutemov , Christoph Hellwig , Miaohe Lin , Gal Pressman , Jann Horn , Jan Kara , Wei Zhang , Mike Kravetz , Andrea Arcangeli , Andrew Morton Subject: Re: [PATCH v4 5/5] hugetlb: Do early cow when page pinned on src mm Message-ID: <20210209175424.GK4718@ziepe.ca> References: <20210209030229.84991-1-peterx@redhat.com> <20210209030229.84991-6-peterx@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210209030229.84991-6-peterx@redhat.com> X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Mon, Feb 08, 2021 at 10:02:29PM -0500, Peter Xu wrote: > This is the last missing piece of the COW-during-fork effort when there're > pinned pages found. One can reference 70e806e4e645 ("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 57efa1fe5957 ("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 70e806e4e645 anymore. > > Reviewed-by: Mike Kravetz > Signed-off-by: Peter Xu > --- > mm/hugetlb.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++---- > 1 file changed, 62 insertions(+), 4 deletions(-) Didn't check every hugetlbfs detail, but looks reasonable Reviewed-by: Jason Gunthorpe Jason