Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1025448pxu; Thu, 8 Oct 2020 00:57:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzglT+o4IhdAsH0J/nnhBj1GJpg7cemt4WeOLQtLD02gIeyc4981dyOXWQYG7j8CNnpx48k X-Received: by 2002:a50:ec88:: with SMTP id e8mr3648407edr.277.1602143839161; Thu, 08 Oct 2020 00:57:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602143839; cv=none; d=google.com; s=arc-20160816; b=GZIZMC4tjja3P4yGHc7JCh88oltp8RwI3rvcBG13/FQ6GGW0/SLjf16zlFH/i7FVqB Zn+ydXjwecjArBywRn0tcfjeKJIypUDA7SdYpFhxxatjI61oAFRrjViU4yMQhX5qzG1s pbyc+kSXSIZbjJ28wJUm9fMep93Zs6Qyb8w8LgpPM7pHmud1B9j0wHeFm8AKKXya7dPr 3UOGn6pBlv97htHpTfRFRJxkZyl0yxGQDGsRUtlSYYCSfA6RRu0VAVsy+IDQqA4EnI2r KLP5JA/p48quNJG2P4l5KgN1zDygIHzvtFxxXBAyzcOx1gk+kwhtAiTT4wc/H3Y3qoW0 EWvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=RHYtPFeMZWLc18KP0oQeXS/4Vq6HE5iYv+578W57cug=; b=fLaeySDpXOz1+AeC1ew2D14h1BjPpV3VTnOmR/LRMiL+E0sS4X2J3QpdRdfTqRDZM9 2ehPQBwDxS91lLTKrocFYXzj+3vVf9UT+JX5HDOaGLJQyyLynAUhJI/2JkLNaK7aElPQ ssVlwzr/nR7DYzuES2jASnAMn8Mz5MisljUpW7lbTO9f3AW8yzZiCEEZ06MNAyzVsktA 3Fwvh/jH5rG95fqO9OenIrTY9/s0hMEEnj1+eCxJ7Ksf/hiV/EGzBdcy8vUv5nUQU+T5 5sn4NxIjiANDbuFBvEJ0LpX9e2byktnCgV5URi2OSJuVlN95E+CfR8bBRngirohUddj0 bcKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=lP17x+FN; 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 t9si3206297ejf.292.2020.10.08.00.56.56; Thu, 08 Oct 2020 00:57:19 -0700 (PDT) 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=lP17x+FN; 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 S1728992AbgJHHzS (ORCPT + 99 others); Thu, 8 Oct 2020 03:55:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52170 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728966AbgJHHzP (ORCPT ); Thu, 8 Oct 2020 03:55:15 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EECFCC061755; Thu, 8 Oct 2020 00:55:14 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id i2so3583857pgh.7; Thu, 08 Oct 2020 00:55:14 -0700 (PDT) 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 :in-reply-to:references; bh=RHYtPFeMZWLc18KP0oQeXS/4Vq6HE5iYv+578W57cug=; b=lP17x+FNFFFLix4HphKfiyj2fY+SOeaElAzyliE0QDst0Kgy0VTVEi5eU1ZRuOFA+u yOmLDKHUfkxwdJJjroxDWyiYbTUf8BbHu1OPFam/fGmSgzw0yhmI+gRg0SPBPrPyyAUn OcCbLhIHO72KoDqmPcloUyiUWPsaguNmqwHAmJtvhUyoDyI2pFgZ8FDRDp8qiLMn9XXn 1GHx99yph5JXE87p/AXyilWvNUHJZ3Ze3esClWvBHYlWBzrDXJQMCOOY9f2xYAC6nyB5 lCSPkcQKhpY5Z3IbxanKzwHgmkVfmeKJ0XMLHQa8iHsSfOy8MShzyFupK9sh6NlNjid4 JPdQ== 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:in-reply-to:references; bh=RHYtPFeMZWLc18KP0oQeXS/4Vq6HE5iYv+578W57cug=; b=HZCHqQYFQHFGh33+cdAPU4a/41O2nQp6kzd/htQwQRMy8+fQPhyFkGGfMQ6y2LZ7Kr yuKjZzDiLWexhMNthM931TUswXM+tjYidcH6Q6DYEb3Dk7ALEUHLqMpYc3KFj7vx62Af 4ClqsVJ2Bsxj1ZyMv3LLV8t9CgTdli/RGnFYTxDhcCAG5j8a+3du0QEONCdowdOziArs Uuq+UVQYrLL6bIvA3g/xvq9AOo/8WBawdacoksCmn3FoZHNXVxXWS/rUOfpNDrWxqWZn vCKNJwxDcjoSPw21iB+RbGDA0fzwcjnDUNDTjDzW5zSY0w6FbrZ2yb+ZVI/tzGkU9fxf MclA== X-Gm-Message-State: AOAM533VOpkBmwfdBXDXFTgWl4WCj7EwwpmXYnYUmJuD1VYHVYObuhQi Y4B69qgemB1mG5DFwgXGlDM= X-Received: by 2002:a17:90a:a09:: with SMTP id o9mr6435104pjo.134.1602143714612; Thu, 08 Oct 2020 00:55:14 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.61]) by smtp.gmail.com with ESMTPSA id k206sm6777106pfd.126.2020.10.08.00.55.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 00:55:14 -0700 (PDT) From: yulei.kernel@gmail.com X-Google-Original-From: yuleixzhang@tencent.com To: akpm@linux-foundation.org, naoya.horiguchi@nec.com, viro@zeniv.linux.org.uk, pbonzini@redhat.com Cc: linux-fsdevel@vger.kernel.org, kvm@vger.kernel.org, linux-kernel@vger.kernel.org, xiaoguangrong.eric@gmail.com, kernellwp@gmail.com, lihaiwei.kernel@gmail.com, Yulei Zhang , Chen Zhuo Subject: [PATCH 20/35] mm: support dmem huge pmd for vmf_insert_pfn_pmd() Date: Thu, 8 Oct 2020 15:54:10 +0800 Message-Id: <7325d4c99cd3bbcd74fac182d06ca17f78c454a5.1602093760.git.yuleixzhang@tencent.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Yulei Zhang Since vmf_insert_pfn_pmd will BUG_ON non-pmd-devmap, we make pfn dmem pass the check. Dmem huge pmd will be marked with _PAGE_SPECIAL and _PAGE_DMEM, so that follow_pfn() could recognize it. Signed-off-by: Chen Zhuo Signed-off-by: Yulei Zhang --- mm/huge_memory.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 73af337b454e..a24601c93713 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -781,6 +781,8 @@ static void insert_pfn_pmd(struct vm_area_struct *vma, unsigned long addr, entry = pmd_mkhuge(pfn_t_pmd(pfn, prot)); if (pfn_t_devmap(pfn)) entry = pmd_mkdevmap(entry); + else if (pfn_t_dmem(pfn)) + entry = pmd_mkdmem(entry); if (write) { entry = pmd_mkyoung(pmd_mkdirty(entry)); entry = maybe_pmd_mkwrite(entry, vma); @@ -827,7 +829,7 @@ vm_fault_t vmf_insert_pfn_pmd_prot(struct vm_fault *vmf, pfn_t pfn, * can't support a 'special' bit. */ BUG_ON(!(vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) && - !pfn_t_devmap(pfn)); + !pfn_t_devmap(pfn) && !pfn_t_dmem(pfn)); BUG_ON((vma->vm_flags & (VM_PFNMAP|VM_MIXEDMAP)) == (VM_PFNMAP|VM_MIXEDMAP)); BUG_ON((vma->vm_flags & VM_PFNMAP) && is_cow_mapping(vma->vm_flags)); -- 2.28.0