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=-7.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 925BEC433E0 for ; Thu, 4 Feb 2021 14:34:55 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2CEF764DDD for ; Thu, 4 Feb 2021 14:34:55 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2CEF764DDD Authentication-Results: mail.kernel.org; dmarc=fail (p=quarantine dis=none) header.from=amazon.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 7B6726B0006; Thu, 4 Feb 2021 09:34:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 767226B0070; Thu, 4 Feb 2021 09:34:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 62F396B0071; Thu, 4 Feb 2021 09:34:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0213.hostedemail.com [216.40.44.213]) by kanga.kvack.org (Postfix) with ESMTP id 495696B0006 for ; Thu, 4 Feb 2021 09:34:54 -0500 (EST) Received: from smtpin08.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 04CC9180AD815 for ; Thu, 4 Feb 2021 14:34:54 +0000 (UTC) X-FDA: 77780832108.08.story04_3c09254275dc Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin08.hostedemail.com (Postfix) with ESMTP id D3D461819E76B for ; Thu, 4 Feb 2021 14:34:53 +0000 (UTC) X-HE-Tag: story04_3c09254275dc X-Filterd-Recvd-Size: 4048 Received: from smtp-fw-6002.amazon.com (smtp-fw-6002.amazon.com [52.95.49.90]) by imf14.hostedemail.com (Postfix) with ESMTP for ; Thu, 4 Feb 2021 14:34:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1612449294; x=1643985294; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=p9V03q8GnkdefDZv70lYQwNtLWDpb3uW9mg5FD1upMQ=; b=HGx4egaRIhB7mW9BxzAiTHv+i0z0PedoIN6OhznfQpmD4Lg70T77pHqh +XZFT42YLS+dsIL0bV7mUxg5nP1P9NKHCoZcrGuiAgjg3HiwwJbJlHCxK 9jSW+QR9IjLnvnFZx71slB4Q1CHL9m0yWHBSQ8WFmLZXDX6ZtSh3fvLTY 8=; X-IronPort-AV: E=Sophos;i="5.79,401,1602547200"; d="scan'208";a="82458978" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-e7be2041.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-out-6002.iad6.amazon.com with ESMTP; 04 Feb 2021 14:33:00 +0000 Received: from EX13D19EUB003.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan2.pdx.amazon.com [10.236.137.194]) by email-inbound-relay-2a-e7be2041.us-west-2.amazon.com (Postfix) with ESMTPS id C11EBA066A; Thu, 4 Feb 2021 14:32:58 +0000 (UTC) Received: from 8c85908914bf.ant.amazon.com (10.43.162.124) by EX13D19EUB003.ant.amazon.com (10.43.166.69) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 4 Feb 2021 14:32:50 +0000 Subject: Re: [PATCH 0/4] mm/hugetlb: Early cow on fork, and a few cleanups To: Peter Xu , , CC: Wei Zhang , Matthew Wilcox , Linus Torvalds , Jason Gunthorpe , Christoph Hellwig , Andrea Arcangeli , Jan Kara , Kirill Shutemov , David Gibson , Mike Rapoport , Mike Kravetz , Kirill Tkhai , Jann Horn , Andrew Morton References: <20210203210832.113685-1-peterx@redhat.com> From: Gal Pressman Message-ID: Date: Thu, 4 Feb 2021 16:32:45 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.7.0 MIME-Version: 1.0 In-Reply-To: <20210203210832.113685-1-peterx@redhat.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.43.162.124] X-ClientProxiedBy: EX13D24UWB004.ant.amazon.com (10.43.161.4) To EX13D19EUB003.ant.amazon.com (10.43.166.69) 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 03/02/2021 23:08, Peter Xu wrote: > As reported by Gal [1], we still miss the code clip to handle early cow for > > hugetlb case, which is true. Again, it still feels odd to fork() after using a > > few huge pages, especially if they're privately mapped to me.. However I do > > agree with Gal and Jason in that we should still have that since that'll > > complete the early cow on fork effort at least, and it'll still fix issues > > where buffers are not well under control and not easy to apply MADV_DONTFORK. > > > > The first two patches (1-2) are some cleanups I noticed when reading into the > > hugetlb reserve map code. I think it's good to have but they're not necessary > > for fixing the fork issue. > > > > The last two patches (3-4) is the real fix. > > > > I tested this with a fork() after some vfio-pci assignment, so I'm pretty sure > > the page copy path could trigger well (page will be accounted right after the > > fork()), but I didn't do data check since the card I assigned is some random > > nic. Gal, please feel free to try this if you have better way to verify the > > series. Thanks Peter, once v2 is submitted I'll pull the patches and we'll run the tests that discovered the issue to verify it works.