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 6CA82C6379F for ; Tue, 14 Feb 2023 17:05:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231776AbjBNRF6 (ORCPT ); Tue, 14 Feb 2023 12:05:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231351AbjBNRFs (ORCPT ); Tue, 14 Feb 2023 12:05:48 -0500 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 24BDD2D161 for ; Tue, 14 Feb 2023 09:04:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1676394246; h=from:from: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; bh=NRv9ri62QZ3gJa1mEP8cILMMa4bJVoJu/pQsWSUh2bo=; b=KBmXPBtxhvX1Xz5PElhZnZItjXydkPlWlQhVN2JhA1K+H1YUlQchZVxhl7Q05TLTCrKLdQ ZZb/nQ0VUiTbtHYyXnmeD5NYF8l3UYRlZtZnBG+vW0Sm0L5Iiz3rLoEXl62TI0tBem8FTH grWP53VY3r06X5V9dRfSk8nqNGu2go0= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-100-0lSj-DwKNHiPhWj7RquMmQ-1; Tue, 14 Feb 2023 12:04:03 -0500 X-MC-Unique: 0lSj-DwKNHiPhWj7RquMmQ-1 Received: by mail-wm1-f70.google.com with SMTP id j20-20020a05600c1c1400b003dc5dd44c0cso8044846wms.8 for ; Tue, 14 Feb 2023 09:04:02 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:in-reply-to:organization:references:cc:to :from:content-language:subject:user-agent:mime-version:date :message-id:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=NRv9ri62QZ3gJa1mEP8cILMMa4bJVoJu/pQsWSUh2bo=; b=M+Af9bYTxs3fxSI+CT5GagyTISSP+SxoNysqRGH+cI/015JG2aK8Q3D6VJ3S4XAopg LB69dp356am4AK60KAKRfjMZpu/CWB5DJvbcxtOw05udcjHzukCIrH8zuAbNpgQj4Lt8 YIDOQG0j1RflmcXX/D9UrBC13eE9nlaLQzTAIOswq8dnjIO/1Ni82uK0O4CQLycAWr6l 3JGgEZcEQLWayxgGRpItfSw1G/lZoQmOQ+RzLTBlabTStCNJJA5tFURxLyu4A7XCsChK eKFaESMr8AZHI8Uvzb2LqWhnHCbvdQ3neT5S/PkCxhgMrpjlx84TqvKKAZNmzfYmzvKM gu+g== X-Gm-Message-State: AO0yUKVxOEuw0Lr2fs2ubUkZWRmOCzU73eHdYrPcdiPrehs7SHEbPyOm GFPyzn5G15Ov6ZQo5qc5p1UhXzhA2yp3lv+zKq8EOWtwMYPTfsROCx5eyqZ9QGdZ20GEbCTSUyf AI2wIhN6qYUDgSIqo8U4WCsT6 X-Received: by 2002:a05:600c:13c5:b0:3dd:daac:d99d with SMTP id e5-20020a05600c13c500b003dddaacd99dmr2527027wmg.36.1676394241790; Tue, 14 Feb 2023 09:04:01 -0800 (PST) X-Google-Smtp-Source: AK7set8tSPkMFovKHAi9fQL2Lota2iYTdYbeJPkqZQwJOal/QZ6PhHFXtJ8m01VC2QuC7xPfjtZ3Cg== X-Received: by 2002:a05:600c:13c5:b0:3dd:daac:d99d with SMTP id e5-20020a05600c13c500b003dddaacd99dmr2526969wmg.36.1676394241490; Tue, 14 Feb 2023 09:04:01 -0800 (PST) Received: from ?IPV6:2003:cb:c709:1700:969:8e2b:e8bb:46be? (p200300cbc709170009698e2be8bb46be.dip0.t-ipconnect.de. [2003:cb:c709:1700:969:8e2b:e8bb:46be]) by smtp.gmail.com with ESMTPSA id t7-20020a05600c450700b003dc42d48defsm20057888wmo.6.2023.02.14.09.03.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 14 Feb 2023 09:04:00 -0800 (PST) Message-ID: <1bee97ef-7632-b1bf-f042-29b97882bfb6@redhat.com> Date: Tue, 14 Feb 2023 18:03:58 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 Subject: Re: [PATCH v4 00/14] Introduce Copy-On-Write to Page Table Content-Language: en-US From: David Hildenbrand To: Chih-En Lin 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 References: <20230207035139.272707-1-shiyn.lin@gmail.com> <62c44d12-933d-ee66-ef50-467cd8d30a58@redhat.com> Organization: Red Hat In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, David / dhildenb