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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5B20CECE589 for ; Mon, 9 Sep 2024 22:44:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type:In-Reply-To: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=cM1LMqruU568mLVa+bcPtcnQ6LfYXyuH9WOTjFAmy/o=; b=Qt37QhWZ+oddQ3YqM9a38qECxS Sb+H8LG92X55ImZ02EPYDKzjp0Zsy1qGD1VYmvD3jCjV9ZH6fppSBD+XicVGh4fzuWSfRtgFnrnWb LA74pcf6CWK3Q5mpK11aURw6YCWUIxhBGlUH/zkG8Km84cL786NbR61/BrEC0zyFXe+Lq3ZV6gRsM hcUull7sQ9Z7DwHhAUrLB/Lk+OvtVbFEByDgmTMupLn0YkQiUB0mnek7PEqBm9VeQGg9asZzyTPEQ bqiUanwyFeN74K7VJjiH0viM5bP+m5+0oh5leEAfmj1zcaeX4U2riIbfAatWr0fZAq+lSu+OD/eSm JHCIueMg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1snn7c-00000003W0o-0Phe; Mon, 09 Sep 2024 22:44:36 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1snn6a-00000003VsT-0WLi for linux-arm-kernel@lists.infradead.org; Mon, 09 Sep 2024 22:43:33 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1725921810; 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: in-reply-to:in-reply-to:references:references; bh=cM1LMqruU568mLVa+bcPtcnQ6LfYXyuH9WOTjFAmy/o=; b=XFbYFa1YI/ogFl6W5NcfTSi200fffEX+u99bG8MpYSTg8e5aF/xeaS0iTMIuN8e5774h3g QU7iqJlPDhg3ctLqzRb4pG8IWhspeWP5eqjNuikZQnLC0oeSTvhzE52ofVmYPBVUzpmpfu gs27Q/Zp1Rmbub2kvtBVhTdRANyE17o= Received: from mail-qk1-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-6aT_xXfVMxKLGo8ZQTWinw-1; Mon, 09 Sep 2024 18:43:29 -0400 X-MC-Unique: 6aT_xXfVMxKLGo8ZQTWinw-1 Received: by mail-qk1-f198.google.com with SMTP id af79cd13be357-7a1d06f8f03so737596885a.1 for ; Mon, 09 Sep 2024 15:43:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725921808; x=1726526608; 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=cM1LMqruU568mLVa+bcPtcnQ6LfYXyuH9WOTjFAmy/o=; b=CruMbKI7iQA3C/fdh8hcApOh447eIkBxM2G4uKFPdUXRMc/l1M6z+11S7HiWidtrdL 7yXJTJD81xroxy0W5SRkh1jNqRBcKI9r2PVjZz9HGXlFw+tua68MwhIJjifUqrB5A/qr YMZzqxbc2NnSR0B+CEv6wyHq3KSNSU5ZqkDNlsC7IaHeWA5TE3Urxx7tX/nXlWun7K1t DwnX+lNI/EwFhId8vn2Bk9/yvcV0338NpzSUI4M5s3BJXjwDp5cjLKlk8i0qmFKDWoZA tY0BiPzmcRRSPE7tUO/tfTip8FogaP0G0Sqc2hV/cB2lPmwSzuuUg/yxsJwZ/V/HMy8t Qh8Q== X-Forwarded-Encrypted: i=1; AJvYcCVLiti+5+ScLMH5spRZ6vdTn0sXCNwRw0+n2D6H/FoPd745gBeOaCHB1lq4tJBo59AZaSfmF8aulfy3O5iRRyfD@lists.infradead.org X-Gm-Message-State: AOJu0YxGUHtsmeObtGflUXhrPVYfBVEG6Uo/aatnLXezHwr0ojQlOIhp YeePmK7AQ+TPAWKvx2Vf2IU0rSRtYmB8dVvGo8sWoL40ZN7LhsCvzWIaPIn4//LAXHvPkzAYVZI fhduYkL7B5p7soddd/ZLAIItWqyNdfhKNxhyYEc/w1wfaDrXLLCiEgi0Bf7IVCa1aBgqyAlvH X-Received: by 2002:a05:620a:40c4:b0:7a9:b3eb:9c91 with SMTP id af79cd13be357-7a9b3eb9f2dmr798954285a.38.1725921808605; Mon, 09 Sep 2024 15:43:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFgXhcazpsa3pwmnq+LCx1Ml8LnWjFodfmG5RpRGh6/fGttMz1xEWApQdheYusHFGBdsnr6MA== X-Received: by 2002:a05:620a:40c4:b0:7a9:b3eb:9c91 with SMTP id af79cd13be357-7a9b3eb9f2dmr798942785a.38.1725921807304; Mon, 09 Sep 2024 15:43:27 -0700 (PDT) Received: from x1n (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a9a799605csm257058585a.65.2024.09.09.15.43.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Sep 2024 15:43:26 -0700 (PDT) Date: Mon, 9 Sep 2024 18:43:22 -0400 From: Peter Xu To: Andrew Morton Cc: Yan Zhao , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Gavin Shan , Catalin Marinas , x86@kernel.org, Ingo Molnar , Paolo Bonzini , Dave Hansen , Thomas Gleixner , Alistair Popple , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Christopherson , Oscar Salvador , Jason Gunthorpe , Borislav Petkov , Zi Yan , Axel Rasmussen , David Hildenbrand , Will Deacon , Kefeng Wang , Alex Williamson Subject: Re: [PATCH v2 07/19] mm/fork: Accept huge pfnmap entries Message-ID: References: <20240826204353.2228736-1-peterx@redhat.com> <20240826204353.2228736-8-peterx@redhat.com> <20240909152546.4ef47308e560ce120156bc35@linux-foundation.org> MIME-Version: 1.0 In-Reply-To: <20240909152546.4ef47308e560ce120156bc35@linux-foundation.org> X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Disposition: inline X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240909_154332_266899_5791D1CB X-CRM114-Status: GOOD ( 30.65 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 09, 2024 at 03:25:46PM -0700, Andrew Morton wrote: > On Tue, 3 Sep 2024 17:23:38 -0400 Peter Xu wrote: > > > > > @@ -1686,8 +1706,11 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm, > > > > * TODO: once we support anonymous pages, use > > > > * folio_try_dup_anon_rmap_*() and split if duplicating fails. > > > > */ > > > > - pudp_set_wrprotect(src_mm, addr, src_pud); > > > > - pud = pud_mkold(pud_wrprotect(pud)); > > > > + if (is_cow_mapping(vma->vm_flags) && pud_write(pud)) { > > > > + pudp_set_wrprotect(src_mm, addr, src_pud); > > > > + pud = pud_wrprotect(pud); > > > > + } > > > Do we need the logic to clear dirty bit in the child as that in > > > __copy_present_ptes()? (and also for the pmd's case). > > > > > > e.g. > > > if (vma->vm_flags & VM_SHARED) > > > pud = pud_mkclean(pud); > > > > Yeah, good question. I remember I thought about that when initially > > working on these lines, but I forgot the details, or maybe I simply tried > > to stick with the current code base, as the dirty bit used to be kept even > > in the child here. > > > > I'd expect there's only performance differences, but still sounds like I'd > > better leave that to whoever knows the best on the implications, then draft > > it as a separate patch but only when needed. > > Sorry, but this vaguensss simply leaves me with nowhere to go. > > I'll drop the series - let's revisit after -rc1 please. Andrew, would you please explain why it needs to be dropped? I meant in the reply that I think we should leave that as is, and I think so far nobody in real life should care much on this bit, so I think it's fine to leave the dirty bit as-is. I still think whoever has a better use of the dirty bit and would like to change the behavior should find the use case and work on top, but only if necessary. At least this whole fork() path is not useful at all for the use case we're working on. Please still consider having this series as I think it's useful. Thanks, -- Peter Xu