From patchwork Fri Aug 9 16:08:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13758918 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 30242C52D7C for ; Fri, 9 Aug 2024 16:09:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AEE766B009E; Fri, 9 Aug 2024 12:09:26 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A9E1F6B00A0; Fri, 9 Aug 2024 12:09:26 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F12F6B00A1; Fri, 9 Aug 2024 12:09:26 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 6D24B6B009E for ; Fri, 9 Aug 2024 12:09:26 -0400 (EDT) Received: from smtpin27.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DE96D1C4A95 for ; Fri, 9 Aug 2024 16:09:25 +0000 (UTC) X-FDA: 82433191890.27.44C2D2B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by imf29.hostedemail.com (Postfix) with ESMTP id D59F3120030 for ; Fri, 9 Aug 2024 16:09:23 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GkUZLCvu; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1723219714; a=rsa-sha256; cv=none; b=6Aifdn4bkzuZl2/544iw0RX9zol3QuL94Ah/nmTZ8Po6ovrFTVgw6I+66CcqGgjjvk1iJD 58Yp6IL763qP3cQ1FswVHVlG0kqd/6ExE+Qq9tm9jh6FObsVHTnybasXbvn98MwkZM5JuH cxAyXcf0Av2jGpMWVcJC2ku95PimmG8= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=GkUZLCvu; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf29.hostedemail.com: domain of peterx@redhat.com designates 170.10.133.124 as permitted sender) smtp.mailfrom=peterx@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1723219714; 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=xVA/urUlESz7em6kHS5QV39/c1UeLmTRXD3YGysY/mU=; b=xCi8n3o3ARILdlkLR8RtjVLV34OCMSV9b+4m+FcQlnc+3vZcczL/hs8D6vY+JR45rk48oo c7g+G2qBhlR+Qa6n9Vghp9HpG53A2prpQnt+/SG0DEBEE7pjpjjJPeIHQDnsJmZk0oOy+T M6yGD3EFFUPYopk4uIHtZTcDCnfAW/w= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1723219763; 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=GkUZLCvuopddhJkdpuui/li0AeWpjBB0pphMwO3InMZmGgUt+ufb5FgXMAvDTfjLoV4ekK lcOdarg1KHIEKWAwhYu8sveewkIBxreZghQTpnLZbapTllKmv+IiNRArXEPHw/796uXk57 ZQSop8f2WPBihcApK03r3llVWBtVSwc= Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-518-kQIgGgLJPoiystyRlBt1Yw-1; Fri, 09 Aug 2024 12:09:20 -0400 X-MC-Unique: kQIgGgLJPoiystyRlBt1Yw-1 Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-7a1d3c02fcfso7766185a.0 for ; Fri, 09 Aug 2024 09:09:20 -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=u2LhdcE35HkoGtfla6isTJ/f7F+w9bN9I+7ByRCLKGgDIzmKQBKlTevAuGqiprSNx4 R0wEW6mo96yKRzYLaVwE6G8Kp+b2+pmFefCiqiZBl0UxV3N/5o9WOAZ2SsneRr1W+3RS Cf+rqAUL58FmOl7WFvhYvV9ttIZqRHbug84xzv6fmjfdL6TKhZSsBmj8hIenLoRx4Vu5 +OFlETphfIQZ/hWV48cN//PzBukC7NcxrUhM+5w5HY8shY5t+HnEzagzNYnJ7q7PDWcl BwLj+Y6DgaKILEVTonBzB3KY/dHfOp9J3cW86dyDc/Ng4wxlRvNLynB/6ltVvqPbsRpl 8lxA== X-Gm-Message-State: AOJu0YwKBdrbu6P6npO2lXdPYFGF1M9gKU6MsXvFshmNZtBlYfhlfPXg EdbNNCJ7Mjz5Uu81mju7OyAFq6TlLSThdHDM9Fm1RXqR30tMmS7zmEYAnLTwK32EFZ8pBvZqMuI GWfyQ3gJTPGyTpKhssiMRO1R+GQf6a7ZK+1qkMKpn6pUvlRNh0ZaS0MRtFcB1ereOdHcnu+ywhx Lx5N+nIJEFwThIwQxEE0J5UOJxC8yWS9Xe X-Received: by 2002:a05:620a:2906:b0:7a1:3ff9:1e1 with SMTP id af79cd13be357-7a4c16af689mr138620085a.0.1723219759145; 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 X-Rspamd-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0br+oR UT0tU0MC zTxba3aMfFuJu8SLBKTcLTZgEEuvon1eiUgaEeagWBOo489ySSSFsRxYJdzIcSzIDgHtGZOiNSk3RqjqXMJXI8QLjZ6ahuhMFhxfXdoQpX1f4d5e4oQb6XRddMwTCnFpXwXScCviaqzeKz11ZDDdSE8lKs8JXJ9enQLtGnr/W1m9KBdmbD/dioBfSfedlu/vMYlFRg5c/Njgrt3X7GpfnuhqRW66lpiPrAS9QnAYO2x6dM10WjZfBpXx60iq4wBBhm+qAUbYVKZcmfqfLUn5dX9i36daO4Xw6lEA9WwTFZDtzu3q+dNX2W5EmtTEM00veUp5IkPPu44HMRpJ1pVoOzc9yrcFYdcccei8z/XVyePXLhTb2DOSgtVIVvijZDHl6QON0FPY0KFuhs33OlsFnOY08odQuMsTHBHB+NqCgvPxXAFM8QxdtaoaV5TqjOtvqmvSnpE93wuh9S/Qp40r4jasSU86VRt5HJhUhVb+my96kk+WS96akJ2f2WNvYNSIh6uAt0ah6hjkx/gn1Kup+hziVYvo2Y8ZzHu8E 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 Signed-off-by: Peter Xu Acked-by: David Hildenbrand Reviewed-by: Jason Gunthorpe --- 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.