Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp996640lqs; Wed, 6 Mar 2024 03:18:59 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCV0u77HpokPg1NrUaX4XKDHTjGqLHWjoIVK5vKaZZOUGfDCc1tkXEgO9gg7iUBHz77jb4C+AMDsdgV5mTU8m/2MxMu6SIfyz8hG1FtMsA== X-Google-Smtp-Source: AGHT+IHAZI1h8VmH2oyBU5td8YD6aqD+ocE9OFNbzdktx8R7hUUbOcGpbF3ClepiUtH1B37WFHou X-Received: by 2002:a17:90a:3907:b0:29b:4dfc:7c34 with SMTP id y7-20020a17090a390700b0029b4dfc7c34mr7356198pjb.33.1709723939038; Wed, 06 Mar 2024 03:18:59 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709723939; cv=pass; d=google.com; s=arc-20160816; b=kEtzEs6qWyStQxVhQDy/Qwuq5Jdc0eRmYpxsDvV0Tlx77vpDRI2lWVVU95j4tL9V+l pdv+GstzCXdsB0cae1cWKw9RDGwFaaaQLVMv4/X1h1KCy/77RlUXiFpuwZn3Due16M0T mzXY2JbNEmAtApITEk57dRhWXUXVHMg8En/ZLOtW0kwjmyXgRsyHk/91b3zwGvZZB4oU ovjjP5ye6o9Plh/eme0iKpLKaF4TMRaufsWiL3Os66YMwSSUvNRYQ++4ZE/nHF3Q6y+E YoNL2DVTco5WQc64Gzh20Qz2O0ykcj40OnaODmjCTQ+mQkXQmp3jUMJg734R/Q3jQen9 Tr8Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; fh=R7qEPKS/quUne42UOOomZJPa3gL5drgDqaCmV8cIock=; b=cuJbw9P1UgKiTjjLL0y8nsdmoC8+481tNwj9UqgdCPHcuWhkuqDELiHGJYJmmnARAQ Y8P+AZTre3UXhaWk6sVg+GE3lkMcgehI6IG2eegr/ASGZWDaPq4O9RcRKJYhUlhcIsba hpRSO0acsVRvlMPd6Zirmix8ZY+z1bmHAijm+isq9sX8tDqT82uS9cZFR1QjBPbWDZsO 09w7mIt05Ir2PzeTOpidr+kuGl+WRzYs+4DMHG0uItSjp2Y22qey7ThMCxRm88mxtWRO crVTit6S/J/PmiLDG4JrZDhrDaB735wlChUuO5hLXOzGuooxBpMyP3LgWlYxvzBiLnBu L/2w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JkO5RP0g; 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-93790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93790-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id x9-20020a17090a9dc900b0029b7ee70f54si28484pjv.126.2024.03.06.03.18.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Mar 2024 03:18:59 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-93790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=JkO5RP0g; 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-93790-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-93790-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id EDBFFB24CC8 for ; Wed, 6 Mar 2024 10:43:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6A8F960897; Wed, 6 Mar 2024 10:42:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="JkO5RP0g" 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 1503160889 for ; Wed, 6 Mar 2024 10:42:38 +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=1709721760; cv=none; b=M9qqFffp2V4TP5jykgZcN1P8U3sC6v248aZdIALZykelPa/FABprBAc83XrtFg2nkIlmrnpeRerkXsPFUDsXDR591Zj9mbx6gw/6CjnIfNbe9aPAerADr16SeKTx+E39E172S6OmIfiq0cf6IokFWsIuRYkIW7uko1IzqW4jqoI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709721760; c=relaxed/simple; bh=iHHSvsdkBOFub0mcOT/89y75sePdz9RiRVPlZT5QMlQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=FkyrDpzoJHjsMGImZId+6L325GUwCM3l3vQ285T9DXumLLu8hJSPZPJreiv2ail7cWSSiw8rFrQRiz13ZJz+y36bUqKS9iMACXk8ClMJ/4NrHlTe1JCMHrDz1xVIlyat8HXW0dfyALz0QR6rga/2Z1LK2xMes7okfi5l6bC8MWI= 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=JkO5RP0g; 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=1709721758; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=dXyJDuJosTa0kFBnhKvW1aqbtapsaxz0OHU+bPr+fnc=; b=JkO5RP0goe2Z5de2+dShM6VHr8uPuoFn7SRydombNzkSOdTa91gPqfUfFsv0bJYQUq4fYy F+LXBfx7lR8gc5/IJhYoFzhCpAoroC0NyXU8NhE1RURoh7/AcHo8I5kwxwBsA/JJyClU11 Cd/fy2NjvJab0vaoqHf0Gu95vbMtHPg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-204-DuM7_ICQNPWc0Qhye-aEuA-1; Wed, 06 Mar 2024 05:42:34 -0500 X-MC-Unique: DuM7_ICQNPWc0Qhye-aEuA-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 068C21C05AED; Wed, 6 Mar 2024 10:42:34 +0000 (UTC) Received: from x1n.redhat.com (unknown [10.72.116.8]) by smtp.corp.redhat.com (Postfix) with ESMTP id D10DC111DCFF; Wed, 6 Mar 2024 10:42:26 +0000 (UTC) From: peterx@redhat.com To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org, Andrew Morton , Muchun Song , Jason Gunthorpe , peterx@redhat.com, Matthew Wilcox , Mike Rapoport , Christophe Leroy , x86@kernel.org, sparclinux@vger.kernel.org, linux-arm-kernel@lists.infradead.org, "David S . Miller" , Andreas Larsson Subject: [PATCH RFC 05/13] mm/sparc: Change pXd_huge() behavior to exclude swap entries Date: Wed, 6 Mar 2024 18:41:39 +0800 Message-ID: <20240306104147.193052-6-peterx@redhat.com> In-Reply-To: <20240306104147.193052-1-peterx@redhat.com> References: <20240306104147.193052-1-peterx@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 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, -- 2.44.0