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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id DF92CC54EE9 for ; Tue, 27 Sep 2022 19:53:49 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D12F8E00FC; Tue, 27 Sep 2022 15:53:49 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 359CF8E00C1; Tue, 27 Sep 2022 15:53:49 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1AD0E8E00FC; Tue, 27 Sep 2022 15:53:49 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 061A98E00C1 for ; Tue, 27 Sep 2022 15:53:49 -0400 (EDT) Received: from smtpin28.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9097180470 for ; Tue, 27 Sep 2022 19:53:48 +0000 (UTC) X-FDA: 79958915736.28.2CB7C24 Received: from mail-pj1-f48.google.com (mail-pj1-f48.google.com [209.85.216.48]) by imf15.hostedemail.com (Postfix) with ESMTP id 1A329A000E for ; Tue, 27 Sep 2022 19:53:47 +0000 (UTC) Received: by mail-pj1-f48.google.com with SMTP id r8-20020a17090a560800b00205eaaba073so513461pjf.1 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=JB3yDOOo7Zkxbg5gukiROC7XguVNa6gZc/ROE7J2IMvWGxJzH1U3FNKefY6oYkMJn4 HIzK+JvUeaXT42aZVZTAHkfsi3lLNQOSY1IcmZ/bBE/h/7M2D0TmWaG9IpaxLxRSTD9l /48WVEmxTLBnu+i/wvRlSoAc5OfUWLdFrF+ot4fafon1/B/3JQ1T5WBVbMjLnV3hVNCo ez/S58JGTt5Uz4jHxfnXkkCsRftBEsNtJWqvo3+w0ThrDm7RKm5VsoNL1zyim0fDXeds Liso2QXKg7kWpyvUBJRGk6iO6eHOhf1sLDAVI0YZffN6RJ+5UtvZPIxpYj1AMyOI+ICf J16g== X-Gm-Message-State: ACrzQf1cINgbfwX35snsOnLLkKQEMCx7aPSGytSkK9snc9l1yx7DjQ3N kstQTMayvZu4eFwWGDqc4iw= X-Google-Smtp-Source: AMsMyM4CHu2/pYiv8P1vxKyV4EcvlYmqhdWDQ4NwzAQ8C9dImRFHhR6yu58N5tI7CNcAlhm/AttP0Q== 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> ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1664308428; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BwxLi034ZmBCXZ/bE4RAvlOWFchcPPbITbc3K0MZeVU=; b=kk/yaR1X97ZEzkCQdYpdeNdLofu95qkTqmgx5kuNNVCDd646+wB2f1Vcl6u5tzwRi+VlH3 APihAP3nCdew4fElM8h7lith0jdMMh47d1dtn/GgVjIsmDgt8W0437ZnPdCfvuErVi2bG9 rWB2tQ4ZkqYcD2FOBJlS9LvVQEuOHdA= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YNNVuaRD; spf=pass (imf15.hostedemail.com: domain of shiyn.lin@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=shiyn.lin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1664308428; a=rsa-sha256; cv=none; b=6robu8pBmqxTi5CFu7rHjwfEwaYXETPW1wnmmmuOj2KC0E30O5N/oz6jGh8y1TlB2YVCNC 2MQxbvdY9TmwOS7tgzhRdJLJF/bm2yZEollQCXZm34t//an1f+flNYOemkjHADqkjb4tRY azhN2mYqycunF69LMoiahgBO0D+sLfs= X-Rspam-User: X-Rspamd-Queue-Id: 1A329A000E Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=YNNVuaRD; spf=pass (imf15.hostedemail.com: domain of shiyn.lin@gmail.com designates 209.85.216.48 as permitted sender) smtp.mailfrom=shiyn.lin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Stat-Signature: bj3xdz7jo6juj5eow9domafwerrgygda X-Rspamd-Server: rspam03 X-HE-Tag: 1664308427-962787 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 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