Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp2320978pxu; Mon, 7 Dec 2020 03:40:19 -0800 (PST) X-Google-Smtp-Source: ABdhPJwFt61BoiKgkrH9Izi2kIPvSoV3UtVnCFVaLWVY3OvzGTo74sr33CgsMh1HeGK3TZ47RdvO X-Received: by 2002:a17:906:314f:: with SMTP id e15mr18053726eje.496.1607341219071; Mon, 07 Dec 2020 03:40:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607341219; cv=none; d=google.com; s=arc-20160816; b=IsQTQK7SaNEhDUH+aMHtXo23AXaq7ECZWMFegjmEelqKwVsnj9t9o/BX9ODSt4ZThF 2EqPSluB1sh5MViekAZyKPCpge2zJvuwx5YoBSA1q2DRSC1cnANSqNAMMt7iF1kydHxD f+TfLjOhBRFs21FAj3FOQ3zxPOjV6JKAQ39/tIRExoVMTjJnIK7c3+ja1MdYDcy3yc0g 0sYr/2LMWXgU9a3Upwm3/mpsJwSvUggY4teTS9LwFf1QbJO/9eVwClMch7RvrrWR6zsq PAhCSzfBZFMh7WCnt7HXrVupr3RuL9v7/9BpsLVP09QdkapCvVipPhvevIL34ZD5Vyxx GYxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=V0y+XXlhGalJMcAfPtOZoEyFt4J5WODB5ittFdj4EUc=; b=oTEHJsYfKpzuEuFayAS4bnxe9yuMADBAQd4DzcRiefqQsHgfAhS7+nBtOhIMbkXBTD gsnOQztsTVqtlmI3ivrbKLYs6G/hAdzVD7cfxGPZcL/+dFYBL4pRAt4dqCLZk9H+bVlt TVcqrASfe3aWmTrO8Wz7vRQ9c1ywm8vwL8HFB/pko/JGqiiXzRS3ElXOT0Uag5+arNPH 8kOfqHR8yc+XUv88STdBVokS8cFVOyne/k60URWXTlRSfsloSMLgop6kYddxM5/hZIR4 8MCrqORAqW793uZD2vuc/1qNm6qjm1VjA/1UbtsNgNqbF6Kf7qeOgD1sdqq5VuwvCLKK tj0A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rWRkAEep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r20si6506953ejz.504.2020.12.07.03.39.56; Mon, 07 Dec 2020 03:40:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=rWRkAEep; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727176AbgLGLfL (ORCPT + 99 others); Mon, 7 Dec 2020 06:35:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40936 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727149AbgLGLfK (ORCPT ); Mon, 7 Dec 2020 06:35:10 -0500 Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 51896C061A52; Mon, 7 Dec 2020 03:34:30 -0800 (PST) Received: by mail-pf1-x432.google.com with SMTP id i3so6028315pfd.6; Mon, 07 Dec 2020 03:34:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=V0y+XXlhGalJMcAfPtOZoEyFt4J5WODB5ittFdj4EUc=; b=rWRkAEepoZ2AAXIS01SYEF9ocTxtc5cj/PFyxRiP37W7nq7Baq7lKLqQ1sovJAs//a d1zGmvUF7iz+BGuUZQV/x3/OWgGxZ4E7wXvRZkhRUY/MccWgFzrVjp+JaxSQpMhgj3S/ ETYvw6meqsHRfGqjL0+qIm9fYduavZsTZkx11ljgBhgD+PZktQFe4FiX8UwISy1teSLt x10aQxM2etDIKPUlcc+xzqN2U3igNRSiFUiFiZ7DWpXSC1epub1tWNPs1sKaUeVMftWu g19anHRd+XMhMmIs4xMVQKHWUmqjfinlCw5B+IgBh6gxXvlvHMT+PYd+rjI2vYOikyBZ Ym4w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=V0y+XXlhGalJMcAfPtOZoEyFt4J5WODB5ittFdj4EUc=; b=GKK+wFsRmHek6h+RycX/otK+WdB76cfnGkG372DdTy+YEYKIgQbkCd29t3CqoDS6Zd 932OrL8Nx/XSyva+XgRX4K5BQQtfUnByUHy/XjeSE5tpfePUf7v/a8ntrv4Min0UayyZ Px7NN9vN2gu1Yc8e8l3f/+rJZcclW9OrwgbdoduJ0W4KcEe7a+4rewqTeKzGn0RILlDt NWDwqCYrg4qYEGfv/xn3ESYhtMzBJV9k3lC4xBbXIMxFq+Gw1Bp3z/1BZwCbsTBULSGw JaZHPCn7L6EYZimhbELOn+dpKu1FHcgeRhK6ERNyJ5JBXEtQzBu2MhYSOsDyh4a0tedr /Q6Q== X-Gm-Message-State: AOAM530L63VBVTDXFrKO6//CNceOqU8nyQ4RKbU3H/54DpGV90I9Jk2S Ins1dPf8+9nDOOaqYUanNL0= X-Received: by 2002:a63:a551:: with SMTP id r17mr2997461pgu.13.1607340869896; Mon, 07 Dec 2020 03:34:29 -0800 (PST) Received: from localhost.localdomain ([203.205.141.39]) by smtp.gmail.com with ESMTPSA id d4sm14219822pfo.127.2020.12.07.03.34.26 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 07 Dec 2020 03:34:29 -0800 (PST) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: linux-mm@kvack.org, akpm@linux-foundation.org, linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: joao.m.martins@oracle.com, rdunlap@infradead.org, sean.j.christopherson@intel.com, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang , Chen Zhuo Subject: [RFC V2 15/37] mm: add pmd_special() check for pmd_trans_huge_lock() Date: Mon, 7 Dec 2020 19:31:08 +0800 Message-Id: <789d8a9a23887c20e4966b6e1c9b52a320ab87af.1607332046.git.yuleixzhang@tencent.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yulei Zhang As dmem-pmd had been distinguished from thp-pmd, we need to add pmd_special() such that pmd_trans_huge_lock could fetch ptl for dmem huge pmd and treat it as stable pmd. Signed-off-by: Chen Zhuo Signed-off-by: Yulei Zhang --- include/linux/huge_mm.h | 3 ++- mm/huge_memory.c | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/include/linux/huge_mm.h b/include/linux/huge_mm.h index 0365aa9..2514b90 100644 --- a/include/linux/huge_mm.h +++ b/include/linux/huge_mm.h @@ -242,7 +242,8 @@ static inline int is_swap_pmd(pmd_t pmd) static inline spinlock_t *pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) { - if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) + if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) + || pmd_devmap(*pmd) || pmd_special(*pmd)) return __pmd_trans_huge_lock(pmd, vma); else return NULL; diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 9474dbc..31f9e83 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1890,7 +1890,7 @@ spinlock_t *__pmd_trans_huge_lock(pmd_t *pmd, struct vm_area_struct *vma) spinlock_t *ptl; ptl = pmd_lock(vma->vm_mm, pmd); if (likely(is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || - pmd_devmap(*pmd))) + pmd_devmap(*pmd) || pmd_special(*pmd))) return ptl; spin_unlock(ptl); return NULL; -- 1.8.3.1