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 B8D6AC52D7C for ; Fri, 9 Aug 2024 16:11:21 +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: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xVA/urUlESz7em6kHS5QV39/c1UeLmTRXD3YGysY/mU=; b=w/iUgcrn2kBSLpDU4Qmo3rzOHI rxps8J1mNJrOOYuDbNDzCui2RVV/in9KwgksNdQE/TsxK0mMMB1S67oxhU5ILCetRnGlzeur48vzA yfAqiICDfcCv43plR9u9KPsYqWLdy24SsDQyY530pHzviewDy0mHPjGRVIFU/GwgfKedD/IpSkkRW 8k0PWpvXpuIAbMuX1+fUNnKhjwO6kAxq7qFLjZ1vRFRmk4tqUKhBRf3RaXvdGLczmAuQns4sSkdFb aIsE9fnee2pofrvRMgJBxvL13PbPWXPk8pVWcYvA57RL4L0DhhuCtmAmc+zCQ5BytyNhL6/Zwv9It kybTXYeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1scSCr-0000000Bq4r-3o6h; Fri, 09 Aug 2024 16:11:09 +0000 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1scSB7-0000000BpJm-3zpV for linux-arm-kernel@lists.infradead.org; Fri, 09 Aug 2024 16:09:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723219760; 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=xVA/urUlESz7em6kHS5QV39/c1UeLmTRXD3YGysY/mU=; b=dTTtQIxpp6qNpBzypXaRlAUVD6r+soiTZNbxn969XXlmgjO4hPaM/UUZ4T1fkp91Cq1Fyr QDCsn5DXuncicmQiJ6d2clPFrJPEOFCQu7Y7k5lKitx4BeYx0HeGm4A6opE4dA3raAaYJP BQPGSWIMdBFUQGV4LMid+wDEMo6MqPs= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-237-g4yEv93FOGiAiRtUZAvt7g-1; Fri, 09 Aug 2024 12:09:19 -0400 X-MC-Unique: g4yEv93FOGiAiRtUZAvt7g-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7a1e1828321so6878485a.1 for ; Fri, 09 Aug 2024 09:09:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723219759; x=1723824559; 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=xVA/urUlESz7em6kHS5QV39/c1UeLmTRXD3YGysY/mU=; b=iyVCnY/WJa3fCVG5d25ZAa7qiA44uA0JkFXVu0HBlN/7Ga0OjfcnhUp0mOcllNO/pG OGXPAy6nF+PIhzTghyg4yolhYkfD7I1IoEbYhxYZH6t0hm71od2FvJjxSfUXK5jnvIrQ 9ksyFlC6lR6C2dz2fA8wObdncRIiq5zi7kwHlDhBTDAnS0IE9+iTaXnDtVMn7c7Vjp+X TdaAohePKQckztbcq4e0ZDCAHk3joT6/WLEGKQ/5kIO7bsFDKaPGtSLrZgEGRCepe/Mc k5xvmPxmEApvkM/kSuSiDjVA2NLk6SgHRlYadcnm8zkQ/OrfKdZdsXenYDAz4XKWxEJJ X58Q== X-Forwarded-Encrypted: i=1; AJvYcCViYsOvP6HOX3sPLPuK9moO9L43WB8bRhFDVi1/dHVAx9sT4nBXWOArmHMDg8b1rWLGx1QuewuWQqwkMWWK/DgCqDMjx2wJrwUE7KDZBu/7l/i0SIc= X-Gm-Message-State: AOJu0YyBOTE43vhRmHKgGNabT0iR8R6qkSxzYt5VZMw19ewzdb4OKtUP y4Gf/f7dgHpi0Ah/Rjo0n9sLaNxcwnX4bPP59284tIFrnRZ/xxHUboMOlfIwwb1zA/NLo3+yzS5 /acdBJuHbJBFHJelijAbNkTWV7JIqVA/e9we9I/d+SIDmRIDwounckdYoWmFvQvUQWCCgWS1y X-Received: by 2002:a05:620a:2906:b0:7a1:3ff9:1e1 with SMTP id af79cd13be357-7a4c16af689mr138617885a.0.1723219759082; Fri, 09 Aug 2024 09:09:19 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHesXKAH7m1pKPVMriR5+O5cSg1VUsP7Em6MavFjtwcHLSKYNYbUt0UMVXsf+PUo1OYJsvsTg== X-Received: by 2002:a05:620a:2906:b0:7a1:3ff9:1e1 with SMTP id af79cd13be357-7a4c16af689mr138614585a.0.1723219758659; Fri, 09 Aug 2024 09:09:18 -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 d75a77b69052e-451c870016csm22526741cf.19.2024.08.09.09.09.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Aug 2024 09:09:18 -0700 (PDT) From: Peter Xu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Sean Christopherson , Oscar Salvador , Jason Gunthorpe , Axel Rasmussen , linux-arm-kernel@lists.infradead.org, x86@kernel.org, peterx@redhat.com, Will Deacon , Gavin Shan , Paolo Bonzini , Zi Yan , Andrew Morton , Catalin Marinas , Ingo Molnar , Alistair Popple , Borislav Petkov , David Hildenbrand , Thomas Gleixner , kvm@vger.kernel.org, Dave Hansen , Alex Williamson , Yan Zhao , Matthew Wilcox , "Aneesh Kumar K . V" Subject: [PATCH 02/19] mm: Drop is_huge_zero_pud() Date: Fri, 9 Aug 2024 12:08:52 -0400 Message-ID: <20240809160909.1023470-3-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20240809160909.1023470-1-peterx@redhat.com> References: <20240809160909.1023470-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240809_090922_175744_D6694BB7 X-CRM114-Status: GOOD ( 16.89 ) 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 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 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 6370026689e0..2121060232ce 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -421,11 +421,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); @@ -566,11 +561,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 0aafd26d7a53..39c401a62e87 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1245,10 +1245,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)) @@ -1496,15 +1494,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. -- 2.45.0