From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CB8C41791EB; Mon, 9 Sep 2024 22:25:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725920747; cv=none; b=kj+VwzKSqJ1+qrYcRn1cLN8EgSLX1iZQqpHq6f2CBCoup+57Rqhz07Rzn97HlTCW9jsFNOqdjyrVHOQK5IOEzHQdry9+f6VsyAXOIE+6ofzFnIzFbiKqwrMMR71lxwy2C/4DLMNq7WXZRpsaqRbAPZjeoOqpy1gsgqnGne096as= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725920747; c=relaxed/simple; bh=4DtzlsFCtPBbW6YIoPEm8DoQZTy56mCz90TYajj6fEU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=ZcF5TwR4qZhA+tjeFXx94kt3pLKN2mfJgneIUKAljJ/QDDc2wFuS3zJuebj+1LS/kAL5/XNkbaIFwTHAkcqt6npymnzI2bWLadYkBypT/QcZA1G0SVEq7cO+wHpXE36V3UK57I1UKboNIhKv+dXUFF41rn4qaiFq046Ewm4x+v8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b=1eDi1aFN; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="1eDi1aFN" Received: by smtp.kernel.org (Postfix) with ESMTPSA id A6907C4CEC5; Mon, 9 Sep 2024 22:25:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1725920747; bh=4DtzlsFCtPBbW6YIoPEm8DoQZTy56mCz90TYajj6fEU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=1eDi1aFNs3Up7hg68+tzcLXlQmtYG+Rjn7OjkCaE09QrgYshaLno0Sr9g50pUA9za 8wKei6dV52DSkpwvoHrI6kRfW+qyoTV5lxxfddYuXlIHsjmkk3KwGb2nM9OHlPIDvT v88QXWRdkWSyqDF1kZnmg001pde8cmzkhaPTXYWo= Date: Mon, 9 Sep 2024 15:25:46 -0700 From: Andrew Morton To: Peter Xu 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: <20240909152546.4ef47308e560ce120156bc35@linux-foundation.org> In-Reply-To: References: <20240826204353.2228736-1-peterx@redhat.com> <20240826204353.2228736-8-peterx@redhat.com> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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.