From patchwork Mon Aug 26 20:43:36 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13778396 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06BAC54731 for ; Mon, 26 Aug 2024 20:44:07 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CEC736B0083; Mon, 26 Aug 2024 16:44:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C74C76B0085; Mon, 26 Aug 2024 16:44:05 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA1436B0088; Mon, 26 Aug 2024 16:44:05 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 8A5E16B0083 for ; Mon, 26 Aug 2024 16:44:05 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 4952FC0F3F for ; Mon, 26 Aug 2024 20:44:05 +0000 (UTC) X-FDA: 82495573650.09.969D9E2 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf20.hostedemail.com (Postfix) with ESMTP id 1C1071C001E for ; Mon, 26 Aug 2024 20:44:02 +0000 (UTC) Authentication-Results: imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tl3d8A2A; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724704928; h=from:from:sender: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:dkim-signature; bh=rCV2q6t08l8ndW0pGxUU3F/GDhRRI1SX3G16E23iQDg=; b=dYlVhY0ugg29smahEruwhvPrEEo+Vsg1D6qsThIRQawRCcHwJvTSnszEMSEj20znlk5WFd U3Px/C+yHtuIsYEi5Bo8GcdAz84JtByIjvjpv91tkN/Wxpv2oI8exKnlqKseFWp9Tv9nqU 01hX3x7xbepaTwFhm0GXZmQVk01fYLg= ARC-Authentication-Results: i=1; imf20.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=Tl3d8A2A; spf=pass (imf20.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724704929; a=rsa-sha256; cv=none; b=MCqn8NuvVaBGgbnriK2DXgR1pc7zH3gHx2EHRC1Vz6WSIe47Yr0bOSj0td83eDH2dNUFZw oysmZz43v4AlvXUGA9/XXs2X+D2MkEexKaRcxYIa7l8+NdsYFNH5Dd0ZQBGUnchlTbesWv Bfeaf2lDOEK4VACfFTX6nRxOb0bCLts= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724705042; 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=rCV2q6t08l8ndW0pGxUU3F/GDhRRI1SX3G16E23iQDg=; b=Tl3d8A2AhgRkTO/Om/ffHNuLk5Tvtkwr+ZhC4vFyHmijx1Um9A9tO5MSWww9vCXXI9JjG2 +xcizImJhRhT03d9MrKB3hA6TpMywsDmYH1QvbCUb42nsK7xyqSwTEalUlagAedDWdcQul 9vnc/5WqJILWqKjB2TV9u8DRG+NfD6o= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-616-xJKtw6tZPfadOM6QvLcQIw-1; Mon, 26 Aug 2024 16:44:00 -0400 X-MC-Unique: xJKtw6tZPfadOM6QvLcQIw-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7a66b52c944so520438785a.1 for ; Mon, 26 Aug 2024 13:44:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724705040; x=1725309840; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rCV2q6t08l8ndW0pGxUU3F/GDhRRI1SX3G16E23iQDg=; b=QoZ22u1wcxhhLX/mw+Pr8D9XvI/jfXC+bnh4TUF3l4azik47bEXoMWEdE4xTDzyaAR IjkC+c/rZoUZiSrDKD3fA5GD4Nz/azWgdkXfctlrTuEa/QQGeRszZPugMfION6QDHTml VR3AmBil26iyFk4HYXfgd32WQDLueb4LrmzNTz1gm4rkJWpY0EKvBn8lX3xKJpCLF8Zc 6KIMkEl47Om9f9Vj7YpVKQtt7jBg452Xc55hetdzyBqGbc8/L8mtkSRDf66EJvd81P7Y uVEw0N/AXRXGwbb4nE9qYU2rUCnjBHXJ4uuGDeybw2Y8lY69PGr0NBbImR39Kwdx7oXe xlEQ== X-Forwarded-Encrypted: i=1; AJvYcCVAkIjH+bO9/XxTyWCJEb5FB1kaXZD5tsyEdwPReO786y+qRaChNLce+Vu9mk4Ar+GuyGI2iKWpfA==@kvack.org X-Gm-Message-State: AOJu0Yw5JtwD2Hzk1SW9H+NINq7FUH2xvRjO0mR2xKBZZmLG6yLwcwEV /b8MVDoOqVEN9ED8khZFLvyS+pXYZ757jRvk4Dj4XnVUpJDbvNb+f9fBvOLAymLWz5hYBU5X53I NutMt7pJYmxsophGZrc0fXjxN//hhGt2lVP4YFTeulkR77E9+ X-Received: by 2002:a05:620a:28c8:b0:7a1:62ad:9d89 with SMTP id af79cd13be357-7a7e4e6d3c1mr92954385a.64.1724705040431; Mon, 26 Aug 2024 13:44:00 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEW5yVxsMo5HJEI7stPZogQTAiTuzeFOof5FGrO8bEsBYthlHw7SRF31ZNT2saoeMAKCiiqzA== X-Received: by 2002:a05:620a:28c8:b0:7a1:62ad:9d89 with SMTP id af79cd13be357-7a7e4e6d3c1mr92952485a.64.1724705040096; Mon, 26 Aug 2024 13:44:00 -0700 (PDT) Received: from x1n.redhat.com (pool-99-254-121-117.cpe.net.cable.rogers.com. [99.254.121.117]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7a67f3fd6c1sm491055185a.121.2024.08.26.13.43.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Aug 2024 13:43:59 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Gavin Shan , Catalin Marinas , x86@kernel.org, Ingo Molnar , Andrew Morton , Paolo Bonzini , Dave Hansen , Thomas Gleixner , Alistair Popple , kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Sean Christopherson , peterx@redhat.com, Oscar Salvador , Jason Gunthorpe , Borislav Petkov , Zi Yan , Axel Rasmussen , David Hildenbrand , Yan Zhao , Will Deacon , Kefeng Wang , Alex Williamson , Matthew Wilcox , "Aneesh Kumar K . V" Subject: [PATCH v2 02/19] mm: Drop is_huge_zero_pud() Date: Mon, 26 Aug 2024 16:43:36 -0400 Message-ID: <20240826204353.2228736-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240826204353.2228736-1-peterx@redhat.com> References: <20240826204353.2228736-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 1C1071C001E X-Stat-Signature: btizhhd94tisgoi7jcc1wjeqkp46metk X-Rspam-User: X-HE-Tag: 1724705042-506633 X-HE-Meta: U2FsdGVkX18imHxFO9pfASj/G7OGmUwa4Ek+RwFJ1o1UJIf2ll7vttw3QVHp5E/dcQptIEHcvZVhpoWntx2PHjX2XZbd4E2yPwK1k+nzRZ6Q42toQU+hNmzZFXbJdpkj+k3RZXZXAcF15CyUP9DcUYuJ65gZ/lg2GkR7Sq2+mkcGRKMA0UVq/T3ZFxtCBoeqzd2alLuGDNe2eBohXNbiLDBH67O3EHgNbnDYwqBeRt2TwJNQi/FVPnsBBQd1M+SBHmELwCiNMw3INUgSng5XP2LeUY2z6P4IGgyAV6H2hlV/HEtWn7BCFXVXqfW9GZFU6sT1zH/khC2TTRQ5ZuIoHsnWXd61Pa50h0UMOY7533hC8Cazdj8+e9HBRClhsXwoqV78t3sc8h5BdkS7KWXTGqaiP/cxlAqPY2/gdyVKKg+57WmoFgnaQJLN2NccBhu08KQOAM4eZSqN9d5K+cxP5DbsmNMtHxpgTOF2bXKGRgvQff92bE3SWHxU65x5jtHxRVJRlezoK8p2UD4xetJLmh1AFSIuK0v3hG7krR/5G2JlSEoZed82WYD+UOqCauvBHFm8lW7t4e9qlm5j00nG1xyF6z13lArvsme2zMiLdyUFYnCs/y5GjHqtgllqLOQQYBJLOPUUqURo1bbXH9jpGd4JX2nCU7wXU7l0BR9JbVKp5UijWIBvR/s51EMfF6IqSvDqihIay9Pzbr5D70/AvLrthEN1MOlw42iCne6hAYRi0Mlkxtjp/LMJimj/MkywkGtiBHvkn4WAD0fFRBbPuWWiVPg7Yz7PvJrwleL3vN1jXbfURmYiwY3l/6TUpz+edBTm9zKE1PT+jxWqmDNFgWjw7iHwZwld6Zt32+kNQvPHnc3X+9eBtrhOpRRRXB4u1/CsPk6gLicL4KVK9bnYdN1GndtoK1U7zy1YHcCSOkYGqcecxIA5VruaKHu8rH4Qirptlp2vadf/oChHc2N +qe1Me2f Q48O9qeXyaM2duCuSb27+8aqhbfixDU2Wp08cpCnkCF5g9uM1s5zexC+UpnqqSPHv/xSz0ULOmIQjWHFQMApOrd28/D+Jd8rl8Z/RkxYTuajnWAxekNxzS2UvehwbADH9+rLuiAceQ1U5ANPIYgv+YmZlv800U+spNVqym8OAlex1RFUTDWP5RObSXWj05wkeLAG53XApI9THVK062i+JRuWVjHM4CekQ46eUw4iAblEVdmVKN2CTKEvPEBXiPCgZOk6XJ05mt+Tw/alGuns6+Ii7TP1lx16lVjuPFpb8RSybVkGMvpUDdC/VcW8+MwKHp9wv7JcVlBbvG+MEp8kZorfLJ4OYFnUHXpzz6P4oC014J8jhl2hLNJpQTfdDxAlAS6oOd7hAUyypCCbzxSOQCBsvzovT2Tbtr1SdrBZBepP4MW8eo1cXX2SzyXIkoPHBxvp+Rw15uBd1L0fWezHriyzzSi04G6K9x7t8qUOgK/9UtMA= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It constantly returns false since 2017. One assertion is added in 2019 but it should never have triggered, IOW it means what is checked should be asserted instead. If it didn't exist for 7 years maybe it's good idea to remove it and only add it when it comes. Cc: Matthew Wilcox Cc: Aneesh Kumar K.V Acked-by: David Hildenbrand Reviewed-by: Jason Gunthorpe Signed-off-by: Peter Xu --- include/linux/huge_mm.h | 10 ---------- mm/huge_memory.c | 13 +------------ 2 files changed, 1 insertion(+), 22 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 4902e2f7e896..b550b5a248bb 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -433,11 +433,6 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) return pmd_present(pmd) && READ_ONCE(huge_zero_pfn) == pmd_pfn(pmd); } -static inline bool is_huge_zero_pud(pud_t pud) -{ - return false; -} - struct folio *mm_get_huge_zero_folio(struct mm_struct *mm); void mm_put_huge_zero_folio(struct mm_struct *mm); @@ -578,11 +573,6 @@ static inline bool is_huge_zero_pmd(pmd_t pmd) return false; } -static inline bool is_huge_zero_pud(pud_t pud) -{ - return false; -} - static inline void mm_put_huge_zero_folio(struct mm_struct *mm) { return; diff --git a/mm/huge_memory.c b/mm/huge_memory.c index a81eab98d6b8..3f74b09ada38 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1429,10 +1429,8 @@ static void insert_pfn_pud(struct vm_area_struct *vma, unsigned long addr, ptl = pud_lock(mm, pud); if (!pud_none(*pud)) { if (write) { - if (pud_pfn(*pud) != pfn_t_to_pfn(pfn)) { - WARN_ON_ONCE(!is_huge_zero_pud(*pud)); + if (WARN_ON_ONCE(pud_pfn(*pud) != pfn_t_to_pfn(pfn))) goto out_unlock; - } entry = pud_mkyoung(*pud); entry = maybe_pud_mkwrite(pud_mkdirty(entry), vma); if (pudp_set_access_flags(vma, addr, pud, entry, 1)) @@ -1680,15 +1678,6 @@ int copy_huge_pud(struct mm_struct *dst_mm, struct mm_struct *src_mm, if (unlikely(!pud_trans_huge(pud) && !pud_devmap(pud))) goto out_unlock; - /* - * When page table lock is held, the huge zero pud should not be - * under splitting since we don't split the page itself, only pud to - * a page table. - */ - if (is_huge_zero_pud(pud)) { - /* No huge zero pud yet */ - } - /* * TODO: once we support anonymous pages, use * folio_try_dup_anon_rmap_*() and split if duplicating fails.