Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1025608pxu; Thu, 8 Oct 2020 00:57:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxyATmxGteAqCfBsXBHOvnaABTqUNZH2YhjDEBc29RqCI2wrkgiSGFwOt+rEd0Dg9CoLmcl X-Received: by 2002:a17:906:7045:: with SMTP id r5mr7321686ejj.355.1602143857913; Thu, 08 Oct 2020 00:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602143857; cv=none; d=google.com; s=arc-20160816; b=mhKzMJZeA6oHfNe2pU+71NOlkSdZmXkSGts0I1gIXR9BH3F4OMicqQwkzM68asbSBa zOfM43DpgVUIieStAjskvtJeHIjLJLkdVS/AwzhO3ENKDscwxc+mp0q+JYlCQCtrkSmb owkmFVcP3NTDIF3RnXHDmMjXLUqD2UbYOVV3Z2M+W2zWnx8FCRu4PFX5SxvIO3nil9Al OI2maQB9OiNJGuNWbnjsnWfPlcwy/c9JEEsoAePa/DflwB1yQTIOTx63uw7fe6qnBSDU 6OSxj+Ht8H0f1XwZOA+Jro5Q5dd4BiAeUZIHWQtCVEgeMHz1z7hb5Pt3OlyEFUuemN4n qRrg== 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=kQ4dDkDLHOzlM4Ta9v469E78PD4zk8EspT9PQyARZLY=; b=Pd4rbP76q6ok3jTPqoejISW+s5IqRRZ3cJZuxd5jH24MohqTd5ajG32tcxPOReLRy7 jWCs0Q4GlVA6LovZ6bw94n8mcz2dwRVCzsDSVE+GCYWP5Tq8HJz7h6uR/D5yAXSLOO7q hxWXi4ifKlWnt6RWAKYhQH/t2KjY8oqogcCf4BLUXkEVtr/7mWzGTr1d3eU7Llyr1cMt bmBRViG2EetW1cB0KrXIeWF23cHXZsJChYWX/RuFoHjVud6nZCbFy9i5io7KL5OXTP5W mXfTlCDezasqlfPIY5RFduKAGG0LhKL1xnmVzkfIHXsXZz6XyNEWQQPr1waRCHhb5000 ZKaQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=hRkiLiH0; 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 t1si2973046ejb.712.2020.10.08.00.57.15; Thu, 08 Oct 2020 00:57:37 -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=hRkiLiH0; 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 S1728956AbgJHHzb (ORCPT + 99 others); Thu, 8 Oct 2020 03:55:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52118 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728871AbgJHHzC (ORCPT ); Thu, 8 Oct 2020 03:55:02 -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 7B6DEC061755; Thu, 8 Oct 2020 00:55:02 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id r21so228945pgj.5; Thu, 08 Oct 2020 00:55:02 -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=kQ4dDkDLHOzlM4Ta9v469E78PD4zk8EspT9PQyARZLY=; b=hRkiLiH0+aLvUr+ptwCCYLTMzxyBKI3GYqDPeHrkc4hbWYiT6E/f2CqdioEdWxlKj+ 2XiFq/vp8j5rdWQq1bCva2BQQpCsf/mR9MXEyGcEdUoNqlWzSpJiOasatdzC9aTMVqHz WYIetmFhyOW3djjHcdFyntUg1yDkLhjuhonsw56YGUVEVwX/8duLgqSG23irVJe0XyzC N4fjzcLferZEl6fW/7nGIbuTgs4reXHcLDd7ev3xioemq987V0KlJv+lDJ47Sx/afilE JJ1aDvayWG8IeG0hedKEzoGZsVZQSiaQ3vkB95yyhMJFRWNEnRETtN7+hj8hada0icYr jZMg== 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=kQ4dDkDLHOzlM4Ta9v469E78PD4zk8EspT9PQyARZLY=; b=TntB9Do/uO34omUbIFPNXnsxmE1BeE2wytW31XPUHlQY1I8XPn5XG7uI82bO1BYgzp BCcJRLSlzNxvJuQ4jaz1X71NupYbl/CCnR5dblwlCMKDufiYT7+DojIOYFU0H2Uc4Nya 8q9L+GH21WmJg/2e3xIN7mFgAX5q4KhIaMmJbw7MoN6C7cTQjsWhc/Xfr5u8LiS4Een3 kjKwz28br+xp5+Ltt9OxVGOKWLUD62cCV26K/ujyPuHc5seJ4aNPF7pzve7WisvvH6RL AosyoHu+683fctiE+o72HrC0yKQDKCD22yFuSm3uLrzA4j+9Q9B0k+DhxB2M0bkALfMX iujA== X-Gm-Message-State: AOAM533X4HLxgDzS0al7WePZNm0q3MmTtnFdlE3F5Qr+tSTGhkEAOPKR keiMoGPdY1SERYSdAhxwFTQ= X-Received: by 2002:a17:90a:ab0b:: with SMTP id m11mr7039002pjq.197.1602143702136; Thu, 08 Oct 2020 00:55:02 -0700 (PDT) Received: from localhost.localdomain ([203.205.141.61]) by smtp.gmail.com with ESMTPSA id k206sm6777106pfd.126.2020.10.08.00.54.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 08 Oct 2020 00:55:01 -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 17/35] mm, dmemfs: support unmap_page_range() for dmemfs pmd Date: Thu, 8 Oct 2020 15:54:07 +0800 Message-Id: <267ac5a8b5f650d14667559495f6028a568abdd9.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 It is required by munmap() for dmemfs mapping. Signed-off-by: Chen Zhuo Signed-off-by: Yulei Zhang --- mm/huge_memory.c | 2 ++ mm/memory.c | 8 +++++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 531493a0bc82..73af337b454e 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -1636,6 +1636,8 @@ int zap_huge_pmd(struct mmu_gather *tlb, struct vm_area_struct *vma, spin_unlock(ptl); if (is_huge_zero_pmd(orig_pmd)) tlb_remove_page_size(tlb, pmd_page(orig_pmd), HPAGE_PMD_SIZE); + } else if (pmd_special(orig_pmd)) { + spin_unlock(ptl); } else if (is_huge_zero_pmd(orig_pmd)) { zap_deposited_table(tlb->mm, pmd); spin_unlock(ptl); diff --git a/mm/memory.c b/mm/memory.c index 469af373ae76..2d2c0f8a966b 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1178,10 +1178,12 @@ static inline unsigned long zap_pmd_range(struct mmu_gather *tlb, pmd = pmd_offset(pud, addr); do { next = pmd_addr_end(addr, end); - if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || pmd_devmap(*pmd)) { - if (next - addr != HPAGE_PMD_SIZE) + if (is_swap_pmd(*pmd) || pmd_trans_huge(*pmd) || + pmd_devmap(*pmd) || pmd_special(*pmd)) { + if (next - addr != HPAGE_PMD_SIZE) { + VM_BUG_ON(pmd_special(*pmd)); __split_huge_pmd(vma, pmd, addr, false, NULL); - else if (zap_huge_pmd(tlb, vma, pmd, addr)) + } else if (zap_huge_pmd(tlb, vma, pmd, addr)) goto next; /* fall through */ } -- 2.28.0