From patchwork Thu Aug 29 20:22:37 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Xu X-Patchwork-Id: 13783801 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 93057C87FD2 for ; Thu, 29 Aug 2024 20:22:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0FDC46B0085; Thu, 29 Aug 2024 16:22:47 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 05DDE6B0092; Thu, 29 Aug 2024 16:22:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E40046B0093; Thu, 29 Aug 2024 16:22:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id C57A06B008C for ; Thu, 29 Aug 2024 16:22:46 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 50456141277 for ; Thu, 29 Aug 2024 20:22:46 +0000 (UTC) X-FDA: 82506406332.19.DEF109E Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 49990180027 for ; Thu, 29 Aug 2024 20:22:44 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YikF8gED; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1724962876; 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: references:dkim-signature; bh=yIlcCFkBaiUavKPXgyUjDxL+3t1TXE/zaK2phWDIt6w=; b=dy25Gd3umLyhh7LYabErfZRvdYiVa8QUWO/hSiILBi20d8PftTXjNr6d9VHMGg1YTCu6nv y7lXMxS2dO6sgT5bIaK1ToRNikjivsv6kqDh1HafnVLVyGO2s7Flue9xCrO0XaL8dzakTU BBQW53HXOfxJ3KrZz8W4S4yOUIkhRtc= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1724962876; a=rsa-sha256; cv=none; b=UA3bbL00JO73BY6SJvFPB6pSFJ5hfykAjOr6FHxj67MrY7JyBXAJxD7jN9nMcbxAjUw1tN E6jgyiftPN5tF0KEMNH4c0cEb5XdgyvS29ehRcSKBjYRUOeV7c3L1T9W6zLylqWlAc0rGb BIUggF1xfyQUU9Szl1uZUTmJkDsydlw= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YikF8gED; spf=pass (imf16.hostedemail.com: domain of peterx@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=peterx@redhat.com; dmarc=pass (policy=none) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1724962963; 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; bh=yIlcCFkBaiUavKPXgyUjDxL+3t1TXE/zaK2phWDIt6w=; b=YikF8gEDAD3MB39sS6OGXN6VnAXIznbaxYJrLtSlu9UAwWNcirGBY78TXr3u1ibcLZZm5m CXjs9PMF9FfvlkhoHkgI0/9xV8/utz149SX7E6qy+VPHoObxSrghx72OVFeWrdsafcRn3N ICPmZfSeon4pkIgcWOCSzCMkebnaDzk= Received: from mail-ot1-f72.google.com (mail-ot1-f72.google.com [209.85.210.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-39-9MUc9PAuMe-ILtyKR0Jjzg-1; Thu, 29 Aug 2024 16:22:40 -0400 X-MC-Unique: 9MUc9PAuMe-ILtyKR0Jjzg-1 Received: by mail-ot1-f72.google.com with SMTP id 46e09a7af769-70f5e0c3b79so1340465a34.1 for ; Thu, 29 Aug 2024 13:22:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724962959; x=1725567759; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yIlcCFkBaiUavKPXgyUjDxL+3t1TXE/zaK2phWDIt6w=; b=WkqXLeeZaxYmQ0eaHBRAXHtIcAPV6BzW6UvFp/eSLS2hO7zoPpKKUs7R/yHtFqSiJu fAGCKVYDmQX90o7Yg0COTEFYI10Xr2rU+K8tjUzlGUj4PHb9wu2MrBNVe8yf+z2bPZcF 2s8ZPm2SPsp+QvXKHrb8yJ6rLgDq/9DCe3ZfcVy3Atpacq9ZILADygJiANVOs+p0d/u2 4ifElHRjpMOVACDrOxr79i+YU7u/b28wykNeNOzwFoVtOk2G2X69M0dg/5N5qBUSdpwG n/jQxzZFbIAeByU9gP2l99cgelS4Ee64/CHBeRMFvu50o9lb8C/rPw0e3wiwZRWuTUQZ PRQw== X-Forwarded-Encrypted: i=1; AJvYcCUxD9KA+1I1ICQwDSgHOXkyNtuK6o3gNiTnX9vSPHfkZ5lRfDfErdTSpk2Zq/zVXiQjDpgW2t1dzA==@kvack.org X-Gm-Message-State: AOJu0YxzVS4X5jbfbc78z/SrQ64LK1saZ4VteGj5j+2AEsh6MAqJKm6g Q3MSV3mvyYAPlqD6n/VKULj4rbPTvMDJ2CeCTcExe6kY6Kz/OZPOF/4AEdxuQ2IHJbnTtakfGZN VzDNtyZ52W2Fz04e9Ma6JEjozC51CTIhz2P6myLqmr0yWbCu9 X-Received: by 2002:a05:6830:6884:b0:704:470d:a470 with SMTP id 46e09a7af769-70f5c48b465mr3967270a34.28.1724962959677; Thu, 29 Aug 2024 13:22:39 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF3D/QgmuWSAwu0zH6SqxrhZIuLPdZ2EGJ8cbRJq+lkIvuviP800t8fhORgXtIOqGLTluRh1Q== X-Received: by 2002:a05:6830:6884:b0:704:470d:a470 with SMTP id 46e09a7af769-70f5c48b465mr3967254a34.28.1724962959366; Thu, 29 Aug 2024 13:22:39 -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 46e09a7af769-70f67173fd3sm68688a34.45.2024.08.29.13.22.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 29 Aug 2024 13:22:38 -0700 (PDT) From: Peter Xu To: linux-kernel@vger.kernel.org, linux-mm@kvack.org Cc: peterx@redhat.com, Andrew Morton , Jason Gunthorpe , David Hildenbrand Subject: [PATCH] fixup! mm/pagewalk: Check pfnmap for folio_walk_start() Date: Thu, 29 Aug 2024 16:22:37 -0400 Message-ID: <20240829202237.2640288-1-peterx@redhat.com> X-Mailer: git-send-email 2.45.0 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Rspamd-Queue-Id: 49990180027 X-Stat-Signature: x7tgcsnkh3ara6fom9dst4mgo35x3esn X-Rspamd-Server: rspam09 X-Rspam-User: X-HE-Tag: 1724962964-537501 X-HE-Meta: U2FsdGVkX1/yuEK/r8IodPMKciJPyN25/D0YWKX8Is2Vaj10NaIGkk0gY5BYTXlmtVVqe5aez3ZHtZ5YGm4ZdtC7kQkLooT6QT79RK0+eo8K3jPtu23jbYB0S1S7WR0tFw0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MdQ2Vf1lBq5cxsYIU0587udCZxrq9yezgUcxNS+NrDj0HvKirAZY2IL6IOhwJYWuswYA2oTi0jGijy4S42Eg9+pBbG2wMIEzW6LyWw8S+V7guht7dU7fFq5R+RTBr18jw1+2IWs7KlXL06Z+eg7iot8ds1fWI9fRQppycCtJQbI6wgVV6peNr9qKh8egvu/nVjsTL/emcY1AJRki05aG7TQrFHgxwjQnd4W+u3D4XtEMK1NOQCYsR6G2gSjwPKS6QhyPjWHwZZ3V/2/O/EeSLTdjqUyOOjl+5VyeA== 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: Per David's suggestion, remove some stale comment in vm_normal_page_pmd() as we start to have special bit in pmd too. Meanwhile move the pmd_special() check here from folio_walk_start(). Signed-off-by: Peter Xu --- Andrew, would you consider squashing this patch into the commit "mm/pagewalk: Check pfnmap for folio_walk_start()" in mm-unstable? This is so far the only thing I plan to update on the huge pfnmap series, thanks. --- mm/memory.c | 9 ++++----- mm/pagewalk.c | 2 +- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/mm/memory.c b/mm/memory.c index 06b42db8a2db..b95fce7d190f 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -672,11 +672,10 @@ struct page *vm_normal_page_pmd(struct vm_area_struct *vma, unsigned long addr, { unsigned long pfn = pmd_pfn(pmd); - /* - * There is no pmd_special() but there may be special pmds, e.g. - * in a direct-access (dax) mapping, so let's just replicate the - * !CONFIG_ARCH_HAS_PTE_SPECIAL case from vm_normal_page() here. - */ + /* Currently it's only used for huge pfnmaps */ + if (unlikely(pmd_special(pmd))) + return NULL; + if (unlikely(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP))) { if (vma->vm_flags & VM_MIXEDMAP) { if (!pfn_valid(pfn)) diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 12be5222d70e..461ea3bbd8d9 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -783,7 +783,7 @@ struct folio *folio_walk_start(struct folio_walk *fw, fw->pmdp = pmdp; fw->pmd = pmd; - if (pmd_none(pmd) || pmd_special(pmd)) { + if (pmd_none(pmd)) { spin_unlock(ptl); goto not_found; } else if (!pmd_leaf(pmd)) {