From patchwork Wed Mar 13 21:47:11 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13591928 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 1521AC54E66 for ; Wed, 13 Mar 2024 21:50:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id: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=rP7jwy9bjyWBqit9KDhjmmA9ufarx4dLvpTmcWkixs8=; b=chiA4NwnLXKUdZ NKRPn/M0/1s19ns4WUV+8YIIRlvalyu4TIiuxZSvBpmpVGcv5Of2lhSetyr6W/pue4eds759zDgsO wLU9yomOqpU6v24GdGo8ME4/ofEV1j7tqMPPtQU6XsaDIzqcN2Ulll05VHr/0X6P1XZV3y39U4eRl u2/YMXfCZuObtfdkh+fFc4Vs2FjHV2Q0VIKqDcGoPyUNMXEVpEWHyp9jCV9q33oVD7ROtS2EZQKXT r4dYxScKagFGX/8tOS68EK+oHMVBjqt5AA9F7VcyjeESwBD7O6FTwVzY5+0CyVcRssj+Z1WrAYzgV YtNgkccQfCUZpso/j8Pw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWU4-0000000C1m0-0uHf; Wed, 13 Mar 2024 21:50:02 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWTE-0000000C1Mv-324B for linux-arm-kernel@bombadil.infradead.org; Wed, 13 Mar 2024 21:49:08 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Type:Content-Transfer-Encoding :MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Sender:Reply-To:Content-ID:Content-Description; bh=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; b=F10dGWxc5ivqPYGcMb21OxCEPb sa4BYZv7UKLMrsUFn9Q1M3ELGu5/Hu+yYXpwrFjlL0/eQBY/7qbvItWQHo8+D/gQZdkjDRlFqwLtm yl2/lx1tQy5Zjjl7D7TnoVNnwkYM+8rArRtcqFDbalqOMOoNcPjlD0dtTSKDM+zCF+cnP/7lvj5XP hp6FKfbeKXmwwp86+nHh/8Bl4SI3ikH7a/r282RZwFw7ynLj8wnXMFAEimhbe5g3eYG3g78o9sOY/ Ol9G89AKrK3Hm+OoRNXkj7Lepf6WlZspF868QvgGlSc6U9FVYZKHYuMMW514bHzrkYtjHTHFdawkG nfXvgLAQ==; Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by desiato.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rkWTA-0000000ACEP-3pTI for linux-arm-kernel@lists.infradead.org; Wed, 13 Mar 2024 21:49:07 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366541; 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=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; b=gr/HbIAy9zjVJUbIte8BiqAx9LncGKiQBOpYE8Wngq09ERl5os5c4nGkdGa0zDEOWNI4GS YHBjpBAdotMP0ijwVpO2/ior6RGa2eVxEFxci6o6fzNHa5ikipyqHstIba3EKuwXKEJ9Fy H8VXZobGiK1xetBPSknxGQJoYVwMw0Y= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1710366542; 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=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; b=Ca+EVIge3KfSaidgqN1KJYfYohk7wlUHfsn+FsqH6Q4To1K3vJpALV7oq29jj/5p7J3mB/ 97g/nsYWaN42wmEuvzRo4WFOUNQ/vcI7dxrvk9a47F+fZYM4aXxUxET8VD851wuijOqT+C ed1xBHZl7IMQU4DMRDHYXKEFiBcuJk4= Received: from mail-qv1-f71.google.com (mail-qv1-f71.google.com [209.85.219.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-515-2Sr-g-8VOkK4pY-dzacNUg-1; Wed, 13 Mar 2024 17:47:29 -0400 X-MC-Unique: 2Sr-g-8VOkK4pY-dzacNUg-1 Received: by mail-qv1-f71.google.com with SMTP id 6a1803df08f44-6818b8cb840so989096d6.1 for ; Wed, 13 Mar 2024 14:47:29 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710366449; x=1710971249; 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=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; b=cXubSpqH/bQmMyJNTzeq2aKfGj0TN4neu1Z4QvhK/cejqMKDPu67UDimWTx2L2DvyD A/v0hdwl+ltA9uy7Qqf2xj+uZ3ZMoxezZMm5Oc/jzAxLCkdbOcRwtuIMqWiBCh9GosqS z2tkALJmE7wy0e/Q/qWkJS0cy1l5pAxid23XGS5r13GTHsLAkF50Whykw+dfxfjVHHi6 4MOdtN6y6z/6F7KIQWeV9iVWNRcGnoDcX1mzEcQo0WchARoxRyCDXZxQUQKDEWvwoKdN 0lPYAdsrr1BfTP6HSlDgfp3loKZcxILI+FMpZ4+TvLe1pz77upqcJu+hRFZZr8+sipU6 FuOQ== X-Gm-Message-State: AOJu0YxjMzr9qU+6PKKP3IBMy4YzcIB7/aZ0jLmPZxG63r0NFjjd1scr vI2gQgrMFp/Uj8LMTGPUtFfuKFtd2xsd6Vc23M+/X+MYzY7Dy36JAKeZ9s1xtYUKXKtEHr3wvUN zQySkRPR66Ibfj+fDh6xm36PSNd8+GIL9JQVxI8R03KEUHvaLxkAWItdpX+LEkBdloZER8skO X-Received: by 2002:a05:6214:aa7:b0:690:d74d:7e6d with SMTP id ew7-20020a0562140aa700b00690d74d7e6dmr2881497qvb.3.1710366448975; Wed, 13 Mar 2024 14:47:28 -0700 (PDT) X-Google-Smtp-Source: AGHT+IELbWWxNSgYU6xiV6giMb0Xazy3M+lqNjbyiI8S6tM3m0hmfGtXABqH+Dtrq87Nz5UyrTDJQA== X-Received: by 2002:a05:6214:aa7:b0:690:d74d:7e6d with SMTP id ew7-20020a0562140aa700b00690d74d7e6dmr2881487qvb.3.1710366448612; Wed, 13 Mar 2024 14:47:28 -0700 (PDT) Received: from x1n.redhat.com ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id dv10-20020ad44eea000000b0069111c5cdd4sm60114qvb.100.2024.03.13.14.47.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Mar 2024 14:47:28 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: linux-arm-kernel@lists.infradead.org, Matthew Wilcox , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , Andrew Morton , x86@kernel.org, peterx@redhat.com, Mike Rapoport , Muchun Song , sparclinux@vger.kernel.org, Jason Gunthorpe , "David S . Miller" , Andreas Larsson Subject: [PATCH 05/13] mm/sparc: Change pXd_huge() behavior to exclude swap entries Date: Wed, 13 Mar 2024 17:47:11 -0400 Message-ID: <20240313214719.253873-6-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240313214719.253873-1-peterx@redhat.com> References: <20240313214719.253873-1-peterx@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240313_214905_461347_DFFD399D X-CRM114-Status: GOOD ( 12.83 ) 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 From: Peter Xu Please refer to the previous patch on the reasoning for x86. Now sparc is the only architecture that will allow swap entries to be reported as pXd_huge(). After this patch, all architectures should forbid swap entries in pXd_huge(). Cc: David S. Miller Cc: Andreas Larsson Cc: sparclinux@vger.kernel.org Signed-off-by: Peter Xu --- arch/sparc/mm/hugetlbpage.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/sparc/mm/hugetlbpage.c b/arch/sparc/mm/hugetlbpage.c index b432500c13a5..d31c2cec35c9 100644 --- a/arch/sparc/mm/hugetlbpage.c +++ b/arch/sparc/mm/hugetlbpage.c @@ -409,14 +409,12 @@ pte_t huge_ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, int pmd_huge(pmd_t pmd) { - return !pmd_none(pmd) && - (pmd_val(pmd) & (_PAGE_VALID|_PAGE_PMD_HUGE)) != _PAGE_VALID; + return pmd_leaf(pmd);; } int pud_huge(pud_t pud) { - return !pud_none(pud) && - (pud_val(pud) & (_PAGE_VALID|_PAGE_PUD_HUGE)) != _PAGE_VALID; + return pud_leaf(pud); } static void hugetlb_free_pte_range(struct mmu_gather *tlb, pmd_t *pmd,