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 DA69EC433E0 for ; Thu, 4 Feb 2021 14:37:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id B8CD664EE2 for ; Thu, 4 Feb 2021 14:37:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236811AbhBDOhH (ORCPT ); Thu, 4 Feb 2021 09:37:07 -0500 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:18701 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236648AbhBDOff (ORCPT ); Thu, 4 Feb 2021 09:35:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1612449334; x=1643985334; h=subject:to:cc:references:from:message-id:date: mime-version:in-reply-to:content-transfer-encoding; bh=p9V03q8GnkdefDZv70lYQwNtLWDpb3uW9mg5FD1upMQ=; b=NrTUm8t6LDmEC4r5fVu6uqnWIBric6BtazQA/RHQdiNIJ2S9cLZquWG8 fZnuVjIhwqpSM7OHKY5KrG94a0VYeCUOeAOEvBb2ILay4HChVKD7TNVTn 0TGgQy2wPDTsM9red2M0s7yoNBuCynwo1TlyUh45dVwNRSsRFyxqar8iL c=; 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.