Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp25145lqp; Tue, 11 Jun 2024 13:16:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVxcV41j28VS8ZlqpUOl/A9pMDDnN4k13TDOO7oqJOMaL2TTFg5U92G9kw7cHbshqR7H8IN320PqPemvacHfxN1ieoYs7p0mUCpf7Z+Ow== X-Google-Smtp-Source: AGHT+IG5lwuOG5qHGVQpvRIFJIK48RiLnNV1Yqge6EjF+RgcH39v3WWjn92fR+rfWtdYaNkZj+4H X-Received: by 2002:a05:6a00:8682:b0:704:2a52:f3dc with SMTP id d2e1a72fcca58-705a84aa3e9mr4095803b3a.7.1718136988543; Tue, 11 Jun 2024 13:16:28 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718136988; cv=pass; d=google.com; s=arc-20160816; b=RtqVwTOtKoSE58fxN/dbG4A4hITRHI0iGO4+HSelcggziG2jouQ9o4LaxiUqndjlga e/7qu4hwgHmQnr9Fxx/jU29TacrznzeWsEf3YnIdAt58/lNfz4xaRNDjtZqjsvCJNcFg ng1RQ+2Oidh9ZCHGZt4Asg/u3+/h8Crn/gl4z4nAKZArjUPxoHbgLm1s0hmxwn1uLAFb ntyp8oirLtNfiiprIu4fR0iWxp+1gR+gAb8bXtUbIwwIbTY8/Bf2W+tvfpAplGOxRNSd JVDMoKTmKilfgduK0Q+RawKx/UpW0PbqNaWGGfpl1j0DbqbvSoglHhHktBF9o0uPwJcA jA4w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=i+9M6etDyTwmu+EVr0Vu4E1n5MFu+UbgfAsiKhMS8w8=; fh=tuLeo+vnemXjpX54+Kx3EYAWYdfuZ7IgVj2JGLerz+g=; b=bJdYYfm+xS+gtarHT0sXIpmm1ZXsfxrk8yr58ZL10h3L+Xf0Zjt3rqgemsHWgMwsVd iQMOBNCr1MJtmA66ImYPN4A7GvgVqOwPnLHGL2emE9vSuTq6IQxmUR5aYvIXAw593WMc 5FHJPsRV3CC0zi1IHkvCA/qrwEeaubMkGDrxiqyJlcIDw/A39p4ceDc5ygrkDpz+eKHx p5PTJrFiP8mNIvWEqJ8qY3ZPOHjvipZ+v2uVm306FatwtheBiSYJc0BNO05mO3PRtw8G 9I8kIU8PA0P10Gn2EEX76tIWhhIw5gjmvqyUfvSRfkjEmNwjNNhAfsDj5VvRUpMqZxN/ v26g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Thu2Lc5g; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-210555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210555-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 41be03b00d2f7-6e93a3db9e6si5753564a12.642.2024.06.11.13.16.28 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Jun 2024 13:16:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-210555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=Thu2Lc5g; arc=pass (i=1 dkim=pass dkdomain=linux-foundation.org); spf=pass (google.com: domain of linux-kernel+bounces-210555-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-210555-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id B539FB22A7B for ; Tue, 11 Jun 2024 20:07:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1CFAF143746; Tue, 11 Jun 2024 20:07:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux-foundation.org header.i=@linux-foundation.org header.b="Thu2Lc5g" 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 45FEA1879 for ; Tue, 11 Jun 2024 20:07:30 +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=1718136450; cv=none; b=HAwX2TbLR2vAiUu8VHU5oCM4KIGO3zqcDNtA8v/5E7lpNSQ8x1xyw4TUX5DHkEc20t/ZR3mE3igFFECdSOpq/UKGFLbqmsDCX07pj4GM1BANOvUpzkFMj/R3BsrOqhXeet14iOvaOpIls83pfX8eHXJXNK0hZKr5cW7ZcArfHUk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718136450; c=relaxed/simple; bh=DG9vo/TGCvMC6IRGF/KFN1oVAg3uKyYRvrG//+CxZaU=; h=Date:From:To:Cc:Subject:Message-Id:In-Reply-To:References: Mime-Version:Content-Type; b=dd3YGTvRpM4btRann1F50w4yGGKzOImvaHEbisQ5+o3koC+cCLLbdFQifidFDJUXGSconeoKEENU9KM9Ej+gJ1jhu6WJJ24D+pW1IMvT1Z4Zw3QnWMaYByqOVifchysxHANkXSG4nU5ImbvvJSeuFFeWMHICKP99nIQQntpLcMM= 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=Thu2Lc5g; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9921C2BD10; Tue, 11 Jun 2024 20:07:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1718136449; bh=DG9vo/TGCvMC6IRGF/KFN1oVAg3uKyYRvrG//+CxZaU=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=Thu2Lc5gQVhk9sw9DKVi+PFqf5BEYPlIHGic73ofQJ/f65R9OYtoAh8p5nGgW6f2g Prjd4WzfOw+X7iK4Aoeqj7B4R86dlrJbqAOZQp3hszmBs7d1vT/i52ufuzBCoqF98A NxfRYSXeRcrwBfQy701uL6t9cpzE6IEHcY3UAOAc= Date: Tue, 11 Jun 2024 13:07:29 -0700 From: Andrew Morton To: Matthew Wilcox Cc: David Hildenbrand , Andrew Bresticker , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm/memory: Don't require head page for do_set_pmd() Message-Id: <20240611130729.d53cbcd1767f917b47540cca@linux-foundation.org> In-Reply-To: References: <20240611153216.2794513-1-abrestic@rivosinc.com> <8040793f-e9e9-4a2e-807c-afcb310a48f5@redhat.com> <20240611110622.8e9892e92618ddc36bca11b7@linux-foundation.org> 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, 11 Jun 2024 19:22:03 +0100 Matthew Wilcox wrote: > On Tue, Jun 11, 2024 at 11:06:22AM -0700, Andrew Morton wrote: > > On Tue, 11 Jun 2024 17:33:17 +0200 David Hildenbrand wrote: > > > > > On 11.06.24 17:32, Andrew Bresticker wrote: > > > > The requirement that the head page be passed to do_set_pmd() was added > > > > in commit ef37b2ea08ac ("mm/memory: page_add_file_rmap() -> > > > > folio_add_file_rmap_[pte|pmd]()") and prevents pmd-mapping in the > > > > finish_fault() and filemap_map_pages() paths if the page to be inserted > > > > is anything but the head page for an otherwise suitable vma and pmd-sized > > > > page. > > > > > > > > Fixes: ef37b2ea08ac ("mm/memory: page_add_file_rmap() -> folio_add_file_rmap_[pte|pmd]()") > > > > Signed-off-by: Andrew Bresticker > > > > --- > > > > mm/memory.c | 3 ++- > > > > 1 file changed, 2 insertions(+), 1 deletion(-) > > > > > > > > diff --git a/mm/memory.c b/mm/memory.c > > > > index 0f47a533014e..a1fce5ddacb3 100644 > > > > --- a/mm/memory.c > > > > +++ b/mm/memory.c > > > > @@ -4614,8 +4614,9 @@ vm_fault_t do_set_pmd(struct vm_fault *vmf, struct page *page) > > > > if (!thp_vma_suitable_order(vma, haddr, PMD_ORDER)) > > > > return ret; > > > > > > > > - if (page != &folio->page || folio_order(folio) != HPAGE_PMD_ORDER) > > > > + if (folio_order(folio) != HPAGE_PMD_ORDER) > > > > return ret; > > > > + page = &folio->page; > > > > > > > > /* > > > > * Just backoff if any subpage of a THP is corrupted otherwise > > > > > > Acked-by: David Hildenbrand > > > > You know what I'm going to ask ;) I'm assuming that the runtime effects > > are "small performance optimization" and that "should we backport the > > fix" is "no". > > We're going to stop using PMDs to map large folios unless the fault is > within the first 4KiB of the PMD. No idea how many workloads that > affects, but it only needs to be backported as far as v6.8, so we > may as well backport it. OK, thanks, I pasted the above text and added the cc:stable. I didn't move it into the hotfixes queue - it's a non-trivial behavioral change and extra test time seems prudent(?).