Received: by 2002:ab2:620c:0:b0:1ef:ffd0:ce49 with SMTP id o12csp467805lqt; Mon, 18 Mar 2024 13:08:53 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWh14Y9eEeENm/Wizn8D+rLewHDBqMNCKwdZNKtbn3adr2vaXW+uB3vU1pxV+q3NkVVr4YN6mKNMNpxuECKmR8vA9vGYbiXiWcGa2BXbQ== X-Google-Smtp-Source: AGHT+IFod+LIGtoSPD1jFpd+fGhqjkjwVacu3NeoOEeIBkcs86/R8eg3Sn8wCtHxJ2UQwzgqkaIg X-Received: by 2002:a05:6a20:4a23:b0:1a1:878d:d3f6 with SMTP id fr35-20020a056a204a2300b001a1878dd3f6mr9312078pzb.26.1710792533369; Mon, 18 Mar 2024 13:08:53 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1710792533; cv=pass; d=google.com; s=arc-20160816; b=oOtRFLm4aeqZsf43d34Z+xYO5JYKdObRJXo2Vf7SR6lqPGOB8XofBnmAl3BhRD6xb2 bw1fLiU17RqyRPymCXBPMYcP4rWViJTTtSe5I0pv8Qa5SRH758psPth6Yms263o7RmSN LjIJ7djs2wXtR/S1ZfRh4KAy8ePFj7RYamm/wORdwAIEUx1oyAi0NOo3yF6tqcvYOUmW rk2IauXf9AKAWHtIVeHh5F/KNBcQIEHR3cUf8aalLvpXb4WQl1JnU6htRzFs33j4SDP4 svFCF56OkPdL6hRGo6bGlgqvO4shxH5fcatpu7106+QnZrci+NVG5T6lNI/4xJpa3yyY HUlQ== 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=4C+lWpN1qDfU+nymiqOVXkY7IqPiijqTb8F5rFjpmTU=; fh=t1i1axy41exDg9N/oI8CYdUNyGR9MEjbjN4dcd81OxY=; b=VB6v1m8UI9NkcnB4W7t9JdjV60V+qkJMx3epi0qFSrJeZzGLIfh3jn8gi/c2Wzth99 E8ZW2DIUdHlXElwo6ZH0kPI8ob/JmPrCBgarNX6eU4Ld8hlguhC6hlBTm1hzq3YcZmh2 /zBwxbsIZcZS08L3u6EnezwdTJbKsz1UFEx/mVNesolEr8OkiWTVSNSkG3zeGiofWKui Ez3yJjl43IzXwNIXXBFKJcFWtyZuN6gg+lz6gvL0IzBMqOKMy0cbK42I6Q7sImhuy8GC 6v7327PpC+e88HYl9xyUSwXLPmveukjLyDX/UeHQINYamyCBNG0doc+D76WQkBzyZOsl qwIw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Q4pSmCqs; 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-106603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106603-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 b19-20020a631b13000000b005d8e379746fsi8749222pgb.469.2024.03.18.13.08.52 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 13:08:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-106603-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=Q4pSmCqs; 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-106603-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-106603-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 218BCB23102 for ; Mon, 18 Mar 2024 20:05:53 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id DD6AC5A7B5; Mon, 18 Mar 2024 20:04:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="Q4pSmCqs" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.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 6B02C5A10C for ; Mon, 18 Mar 2024 20:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710792262; cv=none; b=upFwF/QAF6KqoOwDktJLEsOEDmUcBzH8ZMXzpS44LfBFHJKxno4BaLJn4bsKzAjAeGwZ3MFaImGaUcAi4sQKuOavpifVML4cs03DKGnWn1rhdlxPlVWu/1GVlBImd7+wDbXwXvbo3QC5McHL0tZ67LdK2QCgS8pMM5wkZ9CK0Xw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710792262; c=relaxed/simple; bh=5RHxSgtdvJKVCp5Pr7PrdSJPxWg3TC/UA6xoLVOm0PY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=OtU/n2/jQaHp/xqYysABgxVTrxnj/zWq+3fCP7uMkvTw6bROFmxH6/IZ29je2sXFjpuATqXZdzsHgve8sg77lCmtnSCM6A7qTwr3xHFVuk6QJ6kmDQpWu07QfnyRIx7pjBkM1odOXQ640VswxwPnGMtiBCOGmmaeb9TJvJOQxZw= 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=Q4pSmCqs; arc=none smtp.client-ip=170.10.129.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=1710792259; 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=4C+lWpN1qDfU+nymiqOVXkY7IqPiijqTb8F5rFjpmTU=; b=Q4pSmCqsAEUSRMQIAZlKkFU4pvuON9ds096d1EDQeGDqj50BeVFZe+bY9sOZlWKANnK7fz 2Wx9hRaNILhQfMRzRgBYsydoh2WLwe5tp8ZvlNDuoXwieiGh4t0dNZGr69N9bxFU0bisK4 VVH4ZxO2sqjSL6kXrn70nKNHnb2vi+k= Received: from mail-ot1-f70.google.com (mail-ot1-f70.google.com [209.85.210.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-689-8bNcC5kpOOyVIcC0hyiH4g-1; Mon, 18 Mar 2024 16:04:18 -0400 X-MC-Unique: 8bNcC5kpOOyVIcC0hyiH4g-1 Received: by mail-ot1-f70.google.com with SMTP id 46e09a7af769-6dde25ac92fso2115193a34.0 for ; Mon, 18 Mar 2024 13:04:18 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710792257; x=1711397057; 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=4C+lWpN1qDfU+nymiqOVXkY7IqPiijqTb8F5rFjpmTU=; b=Cpx+jBCnAGUPREv7jCXW8Z1D39oXiZnmX5/l91+WiBOOoMvUS9x4xA70KrpDKd04yJ Su/V6LLFQYjoZZ2LCgiWrxa1tE22sUJKutNMEbEFnyQvY2Kr4bAyEVpmYWldhn49iKev iqepSPN1R0OHLD71egi5141et0vS9HTcXpPmiMS0zXJqIGreIDwmFFQjytQLcKBqtp4i XnZlMrPUoqZr35zMZ7f9DduwXfZQPl8nuvCk0YKU/kXIm3/Q02YsHT0RV4xapaMY5e/S bWOp4l9XJF3iqw2tCOTQvIjNnFqMExPVtM7KNPXxTbj41+OzQ3BZn42Z3fzXMKa/ktQL 2Wog== X-Gm-Message-State: AOJu0YyfmqpE549AVjwspLhfzAz3jgNSCapTiYB271duzux3cTrl1UYC QyBplpDPywcS3x+tkmMFuGF8A7otwBy7ToiYulkJQxoins1LDBdVFvL3i4+Qs6RMOMnDwUqZOjd rh1VurysUAWhE3nfK2psRfvB2tkPO3uA+MAdbHlBIxKBtsAAYx28BwJMwAUMU2X+1m2Z6bNVoVx uGWuMD4ufdbQ+8berOF8WrGSGh3R7c1ppETBmLTC94e8s= X-Received: by 2002:a05:6830:33eb:b0:6e5:14d1:54bc with SMTP id i11-20020a05683033eb00b006e514d154bcmr11071085otu.0.1710792257199; Mon, 18 Mar 2024 13:04:17 -0700 (PDT) X-Received: by 2002:a05:6830:33eb:b0:6e5:14d1:54bc with SMTP id i11-20020a05683033eb00b006e514d154bcmr11071025otu.0.1710792256645; Mon, 18 Mar 2024 13:04:16 -0700 (PDT) Received: from x1n.. ([99.254.121.117]) by smtp.gmail.com with ESMTPSA id hj10-20020a05622a620a00b0042ebbc1196fsm3484491qtb.87.2024.03.18.13.04.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Mar 2024 13:04:16 -0700 (PDT) From: peterx@redhat.com To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: Andrew Morton , x86@kernel.org, Muchun Song , Mike Rapoport , Matthew Wilcox , sparclinux@vger.kernel.org, Jason Gunthorpe , linuxppc-dev@lists.ozlabs.org, Christophe Leroy , linux-arm-kernel@lists.infradead.org, peterx@redhat.com, Russell King , Shawn Guo , Krzysztof Kozlowski , Bjorn Andersson , Arnd Bergmann , Konrad Dybcio , Fabio Estevam Subject: [PATCH v2 07/14] mm/arm: Redefine pmd_huge() with pmd_leaf() Date: Mon, 18 Mar 2024 16:03:57 -0400 Message-ID: <20240318200404.448346-8-peterx@redhat.com> X-Mailer: git-send-email 2.44.0 In-Reply-To: <20240318200404.448346-1-peterx@redhat.com> References: <20240318200404.448346-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 From: Peter Xu Most of the archs already define these two APIs the same way. ARM is more complicated in two aspects: - For pXd_huge() it's always checking against !PXD_TABLE_BIT, while for pXd_leaf() it's always checking against PXD_TYPE_SECT. - SECT/TABLE bits are defined differently on 2-level v.s. 3-level ARM pgtables, which makes the whole thing even harder to follow. Luckily, the second complexity should be hidden by the pmd_leaf() implementation against 2-level v.s. 3-level headers. Invoke pmd_leaf() directly for pmd_huge(), to remove the first part of complexity. This prepares to drop pXd_huge() API globally. When at it, drop the obsolete comments - it's outdated. Cc: Russell King Cc: Shawn Guo Cc: Krzysztof Kozlowski Cc: Bjorn Andersson Cc: Arnd Bergmann Cc: Konrad Dybcio Cc: Fabio Estevam Cc: linux-arm-kernel@lists.infradead.org Signed-off-by: Peter Xu --- arch/arm/mm/hugetlbpage.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/arch/arm/mm/hugetlbpage.c b/arch/arm/mm/hugetlbpage.c index dd7a0277c5c0..c2fa643f6bb5 100644 --- a/arch/arm/mm/hugetlbpage.c +++ b/arch/arm/mm/hugetlbpage.c @@ -18,11 +18,6 @@ #include #include -/* - * On ARM, huge pages are backed by pmd's rather than pte's, so we do a lot - * of type casting from pmd_t * to pte_t *. - */ - int pud_huge(pud_t pud) { return 0; @@ -30,5 +25,5 @@ int pud_huge(pud_t pud) int pmd_huge(pmd_t pmd) { - return pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT); + return pmd_leaf(pmd); } -- 2.44.0