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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 44CD3C64ED6 for ; Tue, 14 Feb 2023 17:56:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232986AbjBNR4p (ORCPT ); Tue, 14 Feb 2023 12:56:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54532 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229661AbjBNR4m (ORCPT ); Tue, 14 Feb 2023 12:56:42 -0500 Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A3232D16C; Tue, 14 Feb 2023 09:56:41 -0800 (PST) Received: by mail-pg1-x536.google.com with SMTP id 7so10778137pga.1; 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=yuyl5BVUyAo1GbSWn5EOatU47uZNMGGUXazmc/8bAnAIss/rfibqAyb8Dme9B429le rWX50uwQ6y1bPBIItLyzLJSc93bm84dyGLNK5znL0Q7w2/PZ5BojAlZs0dmMHYbv5zD2 CLY8s8khKoewl4dJVvpzLjeSKYE9TZi79yd0/xrKfF7c1RQaJ5S5ZEtlL4XU1x/9W4tK xAKKkiIBpF5jXLGvl20l8+Kv5nVNki21qTg/OztU3OozuFKAz/maVtJDa0UDFi6aux// 08HpYZFt1p8U5QMd1+VcVhINYgQY/flvy8AWDgyVP7be6SQfsBDGxEvcSQHl5njX2nWS Nx5g== X-Gm-Message-State: AO0yUKXctyqqGn5RMPK8jETpHmv1qozdGkfqRG++uEcO8nx8SBzbhe8Q 6Vzk52DLXyH/mTefX4Y0v1Q= 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> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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