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 5D229C05027 for ; Tue, 14 Feb 2023 17:56:45 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E62E46B0071; Tue, 14 Feb 2023 12:56:44 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id E12D16B0072; Tue, 14 Feb 2023 12:56:44 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CB3436B0075; Tue, 14 Feb 2023 12:56:44 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id BB21D6B0071 for ; Tue, 14 Feb 2023 12:56:44 -0500 (EST) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 74A72140471 for ; Tue, 14 Feb 2023 17:56:44 +0000 (UTC) X-FDA: 80466652728.22.04318A6 Received: from mail-pg1-f177.google.com (mail-pg1-f177.google.com [209.85.215.177]) by imf10.hostedemail.com (Postfix) with ESMTP id 4A06DC0007 for ; Tue, 14 Feb 2023 17:56:42 +0000 (UTC) Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Igbj7a9t; spf=pass (imf10.hostedemail.com: domain of shiyn.lin@gmail.com designates 209.85.215.177 as permitted sender) smtp.mailfrom=shiyn.lin@gmail.com; dmarc=pass (policy=none) header.from=gmail.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1676397402; 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: in-reply-to:in-reply-to:references:references:dkim-signature; bh=+vJaoDSitwkTGSgQwWnQeK+EQqLoSNY0n4EyW8soc+w=; b=FwI4UFq4vIvNqCJkvaxkvxFA7muHibyWR3g6S9WeXT2O6701ma9zGJCNLFk2BzFHcAUhUf HmP4qm7hJOQQ7HX2I6P6g13wLaY001I/G/reLV4ymGBAeVITCi8k/ZPgQGu9KJRpf5zcPm hLT2ux/dW0nG1PoB5C6jjWJVHwDqtbI= ARC-Authentication-Results: i=1; imf10.hostedemail.com; dkim=pass header.d=gmail.com header.s=20210112 header.b=Igbj7a9t; spf=pass (imf10.hostedemail.com: domain of shiyn.lin@gmail.com designates 209.85.215.177 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=1676397402; a=rsa-sha256; cv=none; b=psEy09EiVw5JcPocvSjaOu9mSrJkGE09416GlBDP5whZRZ76nSZi6UgQkGMk54EEAOSxu1 u/oB34J2SsSMk4MwUGtwBEsj+XUYZjdnHRPZzOfnflGkmvBYME3meXVNDKXkBkarlL8Z7O ucc1mTqoKMye3oowm6/Ztz4OljYXA48= Received: by mail-pg1-f177.google.com with SMTP id u75so10747432pgc.10 for ; Tue, 14 Feb 2023 09:56:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=+vJaoDSitwkTGSgQwWnQeK+EQqLoSNY0n4EyW8soc+w=; b=Igbj7a9tepqc59z5eRzxZcMoUokHgeSoMtRBOizFx3CKNJkKuTCiLi0xOQYzOihtn6 /u7z2gVsfqx+czaQ3Hmk2Sgd3FgyAFcrzTpUmMZ/RpllRncXKEi3oxrQxvNuTFXvcB9o uaey0FvFkdcPMe0UV9eNTdSUth3l/exzp5Y01wBzPwIN/bQos50PoaEHniUyFhGlcOZk mATeNl56n9QhrQUj2HfZOisJ4ihV4of3B3/FpGxTeFRepE4IiyfWYEoCRZiXJRS3NxBc weP2DJ/WdSd7dfMhRPKSu4GygZ4hPwmJqG5xwQLK0UxUWaveJQoeuDfT9TKKn8RnGl+H 1kZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=+vJaoDSitwkTGSgQwWnQeK+EQqLoSNY0n4EyW8soc+w=; b=ifV+MuBkyxJgPEMPLpR2R7atuDmGmBihIEXDpEHXFC3gjsyAFBFE8ETBXRE9H0mOd9 EgbSPSbo0G2nD/nws2JYSPYBy48sQyePjAu9rCWjWOqzcJs0z+Fx6DZBm+xpQ0KaYkVS l86Q7+aOHr9vUWw7VOHmUGomMkKEcrwRXDuJJ8mSAPZtLVUFcknVduTOYVrGmTgQtHXG IA1V3sgObaxYuYPrjJfsHX+CM5uHmhnB6QeYXXeOJ+Mken7EHqhcrgq8Z9k3ff0BHyXb JBTGbSpK5ELWPEjXMiN3nkXRv4S87HUoRRxIPIUZpmxst8eubRWTS/emS6O8nmu5N67l 9/dg== X-Gm-Message-State: AO0yUKV4td143VxitnjqjFvVA/nG27DyiZt/oxx8wN5EQ0qG+Iczcq5w blNeKDnHZvlrJGE/3QHDAeU= X-Google-Smtp-Source: AK7set8axHlRtyebWLewiILfyIm+eC4C+3CI43qb6+37raWc7AqWWJAfImHLAj798iIJo6ilumNtFg== X-Received: by 2002:a62:64cb:0:b0:5a8:380d:7822 with SMTP id y194-20020a6264cb000000b005a8380d7822mr3031237pfb.23.1676397401070; Tue, 14 Feb 2023 09:56:41 -0800 (PST) Received: from strix-laptop (2001-b011-20e0-1465-11be-7287-d61f-f938.dynamic-ip6.hinet.net. [2001:b011:20e0:1465:11be:7287:d61f:f938]) by smtp.gmail.com with ESMTPSA id b23-20020aa78717000000b005a8db4e3ecesm1674976pfo.69.2023.02.14.09.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Feb 2023 09:56:40 -0800 (PST) Date: Wed, 15 Feb 2023 01:56:30 +0800 From: Chih-En Lin To: David Hildenbrand Cc: Pasha Tatashin , Andrew Morton , Qi Zheng , "Matthew Wilcox (Oracle)" , Christophe Leroy , John Hubbard , Nadav Amit , Barry Song , Steven Rostedt , Masami Hiramatsu , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Mark Rutland , Alexander Shishkin , Jiri Olsa , Namhyung Kim , Yang Shi , Peter Xu , Vlastimil Babka , Zach O'Keefe , Yun Zhou , Hugh Dickins , Suren Baghdasaryan , Yu Zhao , Juergen Gross , Tong Tiangen , Liu Shixin , Anshuman Khandual , Li kunyu , Minchan Kim , Miaohe Lin , Gautam Menghani , Catalin Marinas , Mark Brown , Will Deacon , Vincenzo Frascino , Thomas Gleixner , "Eric W. Biederman" , Andy Lutomirski , Sebastian Andrzej Siewior , "Liam R. Howlett" , Fenghua Yu , Andrei Vagin , Barret Rhoden , Michal Hocko , "Jason A. Donenfeld" , Alexey Gladkov , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-trace-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org, Dinglan Peng , Pedro Fonseca , Jim Huang , Huichun Feng Subject: Re: [PATCH v4 00/14] Introduce Copy-On-Write to Page Table Message-ID: References: <20230207035139.272707-1-shiyn.lin@gmail.com> <62c44d12-933d-ee66-ef50-467cd8d30a58@redhat.com> <1bee97ef-7632-b1bf-f042-29b97882bfb6@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1bee97ef-7632-b1bf-f042-29b97882bfb6@redhat.com> X-Rspamd-Queue-Id: 4A06DC0007 X-Stat-Signature: kdugji57ctoamgb9jy614t13c4h9wr9o X-Rspam-User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dhT9DTBuOMwub0EpJv8PDcPqw3EJSkDFJGQiOAhxDDKZU3Kl5+kq+8ckGwt3cEIR2UE5vsJx4eGyfeHnF+g9OeVfRO2MeiP3rADsWfggGlLxAxkfD7g+uodsFIl2hw8riibBGEJ5hjHB+yt1fCqhar15GO9KUGwl8nyjWvx33AIrNjfUxcrMf1iy9dxllsiuU4j7MK81HW6IoZUeNi8AnDqQ8xij2b8oigGO8U+6oMz2dq7QgwzSUw7P6z1ia7a/r3cr9+dt8TUttYez//SIfMg0i1gaRhXTv5nUEXeJSlFE1ilLKAKjwpLWpaVwc1S3AkvHWSaTuFHprcvycGwKeUiHJiOE7HAZoMLpmuR4ReGUdj3HGe2GaP1vBw+kVcaBGjm03+pJCaiBq1/0rtZtuYsMQggG7oVaNGafGiQJ3yWYeMel8kGfe6NqVjxp1E0zHWxBx0FLirduUzAo+NErjKgvP6nX7qV6HQv24lxeb9L4ZB7y9AYYIM9Rdf52XXyKJ3dLlXDSX0D31jyKmPC/cs2ZlnpHZJcHwbvFwrQP8NujR+mpyKIjNd4w== 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, Feb 14, 2023 at 06:03:58PM +0100, David Hildenbrand wrote: > On 14.02.23 17:58, David Hildenbrand wrote: > > > > > > > > > > > > Honestly, for improving the fork(), I have an idea to skip the per-page > > > > > operation without breaking the logic. However, this will introduce the > > > > > complicated mechanism and may has the overhead for other features. It > > > > > might not be worth it. It's hard to strike a balance between the > > > > > over-complicated mechanism with (probably) better performance and data > > > > > consistency with the page status. So, I would focus on the safety and > > > > > stable approach at first. > > > > > > > > Yes, it is most probably possible, but complexity, robustness and > > > > maintainability have to be considered as well. > > > > > > > > Thanks for implementing this approach (only deduplication without other > > > > optimizations) and evaluating it accordingly. It's certainly "cleaner", such > > > > that we only have to mess with unsharing and not with other > > > > accounting/pinning/mapcount thingies. But it also highlights how intrusive > > > > even this basic deduplication approach already is -- and that most benefits > > > > of the original approach requires even more complexity on top. > > > > > > > > I am not quite sure if the benefit is worth the price (I am not to decide > > > > and I would like to hear other options). > > > > > > I'm looking at the discussion of page table sharing in 2002 [1]. > > > It looks like in 2002 ~ 2006, there also have some patches try to > > > improve fork(). > > > > > > After that, I also saw one thread which is about another shared page > > > table patch's benchmark. I can't find the original patch though [2]. > > > But, I found the probably same patch in 2005 [3], it also mentioned > > > the previous benchmark discussion: > > > > > > " > > > For those familiar with the shared page table patch I did a couple of years > > > ago, this patch does not implement copy-on-write page tables for private > > > mappings. Analysis showed the cost and complexity far outweighed any > > > potential benefit. > > > " > > > > Thanks for the pointer, interesting read. And my personal opinion is > > that part of that statement still hold true :) > > > > > > > > However, it might be different right now. For example, the implemetation > > > . We have split page table lock now, so we don't have to consider the > > > page_table_share_lock thing. Also, presently, we have different use > > > cases (shells [2] v.s. VM cloning and fuzzing) to consider. > > > Oh, and because I stumbled over it, just as an interesting pointer on QEMU > devel: > > "[PATCH 00/10] Retire Fork-Based Fuzzing" [1] > > [1] https://lore.kernel.org/all/20230205042951.3570008-1-alxndr@bu.edu/T/#u Thanks for the information. It's interesting. Thanks, Chih-En Lin