Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp212740lqb; Thu, 23 May 2024 16:07:22 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW7zt7l7M+oYt4A0pBNoG1XeDFSO/LE5Rm73ucCBkv1C188mOMlufqSWrWnt9+hFYgSF4DdMkTFYI7ySI98NvBEplxJG+GVA8hOzxNAGA== X-Google-Smtp-Source: AGHT+IH1CQ/on1XZaF071X0wLut7dW/zuZR/529FzPV0v4hQlKnc18hG3T1VEp9CJfRRFu0LU/fj X-Received: by 2002:a19:f613:0:b0:516:cc2d:f6a1 with SMTP id 2adb3069b0e04-529661f2e19mr212088e87.51.1716505642105; Thu, 23 May 2024 16:07:22 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716505642; cv=pass; d=google.com; s=arc-20160816; b=NGj16i7GbAK5NL7b7MQ21JFyUN0AIHC11hiUJz/o3a0GI5Hbd+/wiL7j7PlxwgSBu+ fD5T2YDkTqZHiplop/nmbtjEO2aptGoSmJ4KROnfSFA6UzaxN9zb2I1K7l1JzDIGFif5 OgqDQxKOpSgzcCvjJnLl3p3XA4SSMeu+HDrxtiBB9UAWIuLJAfqVswDTU9PrgK8FwjlF k2sBQpBiez+jekXmQhaljRozLu5/ST0T3Sh8QtX2VNN6rhKd0R2TNl9GLt1Hy+3ABzvs ouhfyPmR6i+2dl6l+tp2bu+UXUSzaB/0Y8LSibiEd5cn1nhcF2s/ONrITnEi2fh0jOnL nYlw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=9qOKzlr6EnmYdUBbeyGsYX+lnRnuf7tx0Aba9aPBtzo=; fh=bUN+wK8Xh2Qf95g16ZBO6GoysPF8tbPRddOIoWYBfdE=; b=GfyJ4fcVDuK3QR7XG9XicABvtAbB1RQ1rhckvX8dPeum8Mu8gsREkuJGXzb0Z5YysL KlLeJAnycdA1vGrU32OnrRrDIfryNzJFORwvMiTOCBCebQ/DRtys8TFoDVCv7pvMDycU oJ5UeuvggAUOl9AcAS8+jN3p9jgMnjoxKHvur8ik4kZi5MYJRn8C+YPwqbEUS76Cmhnb BTo3HYkpZJ+QtkLpVPHCPi2qD6LMnAp92yzor45k7sYXKLhy1hOEhacNfzVuadab98ar hMenj19F0noy2viWUL900iibQADJ57z7xJrtZM5/WeLFr0+jUHqTcvrr8qjIl9FU2yBT CpOg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TKOYZL+L; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-188095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785249793esi182578a12.471.2024.05.23.16.07.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 16:07:22 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=TKOYZL+L; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-188095-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188095-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id CC6591F23275 for ; Thu, 23 May 2024 23:07:21 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9C65312838E; Thu, 23 May 2024 23:07:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="TKOYZL+L" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) (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 5E1B6763E6 for ; Thu, 23 May 2024 23:07:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716505635; cv=none; b=aTsk6ktiBXSCC3P82A3ey3nBCIH5J7+kA8/1ae41caKds2PWQ47gb5FCusY2tcwgABarO4Ir8g9T/dWPJJwm466YKF7BCvTJlnJBuNGUa5ycf+WJe/wgQSK+WR1oecI8ef3fgOAxxYq88z7lXKHyKpPVKYxlSo4uMkV0pdUw/jg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716505635; c=relaxed/simple; bh=IVN/mtqfTzSQz5DOSJd2FkfrtcnQCqUA3LMLgp5J74w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=O6m8HWbWfAvU+Jrvr6C3jbTnTAbChZ3Op3mAiIN5pl8osJcd6xh7oC/SWC05hlsiNAgqzMj/bXoMkv6PbE4NCIkNXznh9B8vYJa1wLywRI+yg5AHxhXMhpZppkjqYKC2Yb4FWkq2tRvesfgJx6xHD8LKtSleQcnLLJB+kCWzvGY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TKOYZL+L; arc=none smtp.client-ip=170.10.133.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1716505633; 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=9qOKzlr6EnmYdUBbeyGsYX+lnRnuf7tx0Aba9aPBtzo=; b=TKOYZL+LOEh/5NHOi3PA38DFsQtWX+/h5lT1IAD/6EoXZ3VsEs/k6RsZeFK2MxNJsmKocZ giacGBajqRh8NBN8pEBdD6kkys0TKPJs3uXBE10ahLC0jhvOMVSXpnk6m1RvGAZWBdkOmy z7uchTXEJaYOc5rqIf9eyydIqpAvxV8= Received: from mail-oo1-f69.google.com (mail-oo1-f69.google.com [209.85.161.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-460-b1QWOzH8MyOEXg-l_JzWBA-1; Thu, 23 May 2024 19:07:11 -0400 X-MC-Unique: b1QWOzH8MyOEXg-l_JzWBA-1 Received: by mail-oo1-f69.google.com with SMTP id 006d021491bc7-5b96a7cc02dso55782eaf.1 for ; Thu, 23 May 2024 16:07:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716505631; x=1717110431; 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=9qOKzlr6EnmYdUBbeyGsYX+lnRnuf7tx0Aba9aPBtzo=; b=CnJBTtUz2AaO7DxzzZK2P5cxUZh0ScGyj7MF/WdfHqZCH008lSWT0J5YhDLHjO3Qq3 4sd2We615oSr9b6lphEmE78V97wS9f07xzmqt5E7jldgnrX+IpK6S2ITJ8a/B3FUyidg 7YAAm1tA3vkcK37SCxnU/b3/yGCDH4hEiWuQVH+EZ4CNxjYVXWZsyOtqsk/kdauw29sd Etzct1Hj6rO/1a/F8YbTpMDgUpIhFWqhO/aRMLhY/LrMRki2IsH+c2gafhcvS1/MsiD+ kkLS+w49mMZ38h8SsFTgQXK3/U69Bqpxzq2tRJU7OdeURamqmT83AZZw50AMJaQzYxc2 QESA== X-Forwarded-Encrypted: i=1; AJvYcCXdnaZ/t06qoCEy06Hn4clAMlW3lRJCTFxgFvRCE+0Y3tE34GTZ9bRdifGWXW/FA3Nh6/qVosPJeD1HRjAr1OGrmW9MGphf7NkXNOcP X-Gm-Message-State: AOJu0YzUJtXh5tJDDAA52iOawym8q8BG9yxAUi68h2MMyP1Tp1cnZEEj mrQ9vGq/Mc3b6EIyU7N8t5JdBru1HDIi3psJzBy/fut6ziS3GoTNo9a3nypBYjyH+pD1aY+HLXF ie9Ztgn956+pGlM4PVWrC+yCZI3ZzTF42zOck3qan0Bmtr+l7EJVR1SrFBx3Epg== X-Received: by 2002:a05:6358:895:b0:191:f9d:3468 with SMTP id e5c5f4694b2df-197e4844d1cmr101528555d.0.1716505630326; Thu, 23 May 2024 16:07:10 -0700 (PDT) X-Received: by 2002:a05:6358:895:b0:191:f9d:3468 with SMTP id e5c5f4694b2df-197e4844d1cmr101525455d.0.1716505629618; Thu, 23 May 2024 16:07:09 -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 6a1803df08f44-6ac070f3298sm1303906d6.66.2024.05.23.16.07.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 May 2024 16:07:09 -0700 (PDT) Date: Thu, 23 May 2024 19:07:06 -0400 From: Peter Xu To: Dave Hansen Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, Thomas Gleixner , Jason Gunthorpe , Andrew Morton , Al Viro , Dave Hansen , Andy Lutomirski , Matthew Wilcox , Dan Williams , "Kirill A . Shutemov" , Mike Rapoport , Ingo Molnar , Michal Hocko , Alex Williamson , Peter Zijlstra , Suren Baghdasaryan , Borislav Petkov , x86@kernel.org Subject: Re: [PATCH RFC 2/2] mm/x86/pat: Do proper PAT bit shift for large mappings Message-ID: References: <20240523223745.395337-1-peterx@redhat.com> <20240523223745.395337-3-peterx@redhat.com> 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=utf-8 Content-Disposition: inline In-Reply-To: On Thu, May 23, 2024 at 03:48:22PM -0700, Dave Hansen wrote: > On 5/23/24 15:37, Peter Xu wrote: > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index 317de2afd371..c4a2356b1a54 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -1135,7 +1135,7 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, > > goto out_unlock; > > } > > > > - entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); > > + entry = pmd_mkhuge(pfn_t_pmd(pfn, pgprot_4k_2_large(prot))); > > if (pfn_t_devmap(pfn)) > > entry = pmd_mkdevmap(entry); > > if (write) { > > Does this even compile on non-x86 architectures? Probably not.. I think I can define a pgprot_to_large() globally, pointing that to pgprot_4k_2_large() on x86 and make the fallback to be noop. And if there's a new version I'll guarantee to run over my cross compilers. Any comments on the idea itself? Do we have a problem, or maybe I overlooked something? Thanks, -- Peter Xu