Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp1426923rwb; Tue, 27 Sep 2022 12:57:01 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6Re3t1LOYzcpCO7D2wwqlJmpBGVf9KOMu419z1/lzaESN5PVn9rUqlMzRMbGKO6idtRkUl X-Received: by 2002:a63:5f16:0:b0:439:41a8:ab4e with SMTP id t22-20020a635f16000000b0043941a8ab4emr25856720pgb.195.1664308621466; Tue, 27 Sep 2022 12:57:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664308621; cv=none; d=google.com; s=arc-20160816; b=RHZd6qpeJvTVLDMmb3caKyJW3VtX5nJcvmOZHjbWySiv3xkklS6uTFJCHnEbGw6fH9 GcJiUjOep8D2/GvVdxpQgSanBbw00S1tc6z4uVayD4RrRC/MkgE6/IvN67a4z+c3/CXx 5vE8lyOGuhfb6f363MXPw/0sLbhT/u8wyWGuFbjcHSVQ7CfeSMWnbXMLWr2crPNeXlcI SeQdr6ettksWU/74FGCbCtnyAYNHF+Q6Z7ATeNbGSCVy7zP8HNP+IUtv3ov0IhxKSGJZ L3e9umzLCSsE1mNbQeDCthIK9ig8mhlDfMEIsV6HhWzwoLg4AJG17i4RCdkS79aigqbC Gm/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=BwxLi034ZmBCXZ/bE4RAvlOWFchcPPbITbc3K0MZeVU=; b=Tr+6LxuaJTPmbKSzmk7MYs6vbOpmD0WKzeeVfRO9WXQSb83LlgRINoHVdDJ/kBIvn+ TMSKxBP/fXDlZ4Jm0oLAKZMbDE0Ge9ZrWQMHI2SxA0edKu1AVLDWTcyAbbvUbBB8WolG 0ztQWDld3NV4JEXrlt1B90+v94PXG7tuaiaXPgTY0gPqTpejbBiADeDt3P24y0Kq2WlQ Cf3bat12bWAhKeyFZtgRkT5kzQV41PyGtGeCKTzGj5RaHcfFbTyTCeb4qHzFDcysMLrt EB9WFjgadBi27e9kEGqvbINxTYg+PkqJ0AUYmSQJMPEeHPCNPLNtBDjQeB3j9/iPrr5V 3xjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YNNVuaRD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v202-20020a6361d3000000b004343832f543si2708514pgb.450.2022.09.27.12.56.50; Tue, 27 Sep 2022 12:57:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=YNNVuaRD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232103AbiI0Txv (ORCPT + 99 others); Tue, 27 Sep 2022 15:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232078AbiI0Txs (ORCPT ); Tue, 27 Sep 2022 15:53:48 -0400 Received: from mail-pj1-x1031.google.com (mail-pj1-x1031.google.com [IPv6:2607:f8b0:4864:20::1031]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8F661E05F7 for ; Tue, 27 Sep 2022 12:53:47 -0700 (PDT) Received: by mail-pj1-x1031.google.com with SMTP id q15-20020a17090a304f00b002002ac83485so11079453pjl.0 for ; Tue, 27 Sep 2022 12:53:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=BwxLi034ZmBCXZ/bE4RAvlOWFchcPPbITbc3K0MZeVU=; b=YNNVuaRDR5Ft7r8wpzjocZ2lNbS9QN3uhBOhPGelD3X6TgQyvDQLML1Dovg3NSAzB8 OLJEa3pcWHat4D3ij98oXv6bZD+rh2jiUMrLH3ByjjaaAl6Ym1akPfJH+JeLLqRddv2J 1ElrkKgCBBx2wxK6EC8KrHYBneZLaEl/oFD5pyDU3g5J41JnZ1yD8xFVU4rh8RJoQb9Y eaHPb0zJ4zEc7ME63cxEouR/jN9VJdF4ahi3KLS4Z16CLvHrjqNg8/VjhEcJfje0Ndxe Bx9ai8gsQCR/kAd+++m/Tu2sTb5UQ6YeQkZy7nlK61fNvGs+bMql4lUhBguZB+iMlPHp YCWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=BwxLi034ZmBCXZ/bE4RAvlOWFchcPPbITbc3K0MZeVU=; b=v7qVVOHMf1CfgHu7riVYI/8tfV/HmAKyA00Jv4jyaMt2SGQ9b158pjGvbx9cJrqJlL 6gJb+zgNMl1GeJd0rlo6NL+cIzi2/RbK0YmMIBKQt1WAg71e9kL/YypXgLn2D+2GT8zh VdjmlCrp+r/tKQEpW5YVBuOqnifRhSVeckPzcVibblm+DDwnb5ypIZOwI3twFEX4Ivwh ia26Dwpffy8uWyKmqJngBPJA46bzG26qYa0YzygE9pzAyPbfbbkvTMii+TDdQY2ZCX5i e69UODfKNvOU8Ax49ELK75f79M7i8BNrT6FJXVy/KIGHVr6aToK3Cm1gWifHZsNS6nGh sMlA== X-Gm-Message-State: ACrzQf0y84+FCyIzlsdKwhaHsTWD0EQNsCFU9It0aYaon0p+bxU6UBtN agbetR3PeFJKUEJG7ViOSf0= X-Received: by 2002:a17:902:d50e:b0:176:e777:59c4 with SMTP id b14-20020a170902d50e00b00176e77759c4mr28502492plg.82.1664308427019; Tue, 27 Sep 2022 12:53:47 -0700 (PDT) Received: from strix-laptop (2001-b011-20e0-1b32-d148-19d6-82fa-6094.dynamic-ip6.hinet.net. [2001:b011:20e0:1b32:d148:19d6:82fa:6094]) by smtp.gmail.com with ESMTPSA id h4-20020a17090a3d0400b002002014039asm8951691pjc.6.2022.09.27.12.53.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Sep 2022 12:53:46 -0700 (PDT) Date: Wed, 28 Sep 2022 03:53:39 +0800 From: Chih-En Lin To: Nadav Amit Cc: Andrew Morton , Qi Zheng , David Hildenbrand , Matthew Wilcox , Christophe Leroy , "linux-kernel@vger.kernel.org" , "linux-mm@kvack.org" , Luis Chamberlain , Kees Cook , Iurii Zaikin , Vlastimil Babka , William Kucharski , "Kirill A . Shutemov" , Peter Xu , Suren Baghdasaryan , Arnd Bergmann , Tong Tiangen , Pasha Tatashin , Li kunyu , Anshuman Khandual , Minchan Kim , Yang Shi , Song Liu , Miaohe Lin , Thomas Gleixner , Sebastian Andrzej Siewior , Andy Lutomirski , Fenghua Yu , Dinglan Peng , Pedro Fonseca , Jim Huang , Huichun Feng Subject: Re: [RFC PATCH v2 9/9] mm: Introduce Copy-On-Write PTE table Message-ID: References: <20220927162957.270460-1-shiyn.lin@gmail.com> <20220927162957.270460-10-shiyn.lin@gmail.com> <3D21021E-490F-4FE0-9C75-BB3A46A66A26@vmware.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <3D21021E-490F-4FE0-9C75-BB3A46A66A26@vmware.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 27, 2022 at 06:38:05PM +0000, Nadav Amit wrote: > I only skimmed the patches that you sent. The last couple of patches seem a > bit rough and dirty, so I am sorry to say that I skipped them (too many > “TODO” and “XXX” for my taste). > > I am sure other will have better feedback than me. I understand there is a > tradeoff and that this mechanism is mostly for high performance > snapshotting/forking. It would be beneficial to see whether this mechanism > can somehow be combined with existing ones (mshare?). Still thanks for your feedback. :) I'm looking at the PTE refcount and mshare patches. And, maybe it can combine with them in the future. > The code itself can be improved. I found the reasoning about synchronization > and TLB flushes and synchronizations to be lacking, and the code to seem > potentially incorrect. Better comments would help, even if the code is > correct. > > There are additional general questions. For instance, when sharing a > page-table, do you properly update the refcount/mapcount of the mapped > pages? And are there any possible interactions with THP? Since access to those mapped pages will cost a lot of time, and this will make fork() even have more overhead. It will not update the refcount/mapcount of the mapped pages. I'm not familiar with THP right now. But we have a plan for looking at it to see what will happen with COW PTE. Currently, I can only say that I prefer to avoid involving the behavior of huge-page/THP. If there are any ideas here please tell us. Thanks, Chih-En Lin