Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp210894imm; Fri, 13 Jul 2018 22:02:18 -0700 (PDT) X-Google-Smtp-Source: AAOMgpfdRk+9dXBm0zLSH+jGtWtVqKCPlRjOQY9eHAav7zZgITdFdaQzW6lY6UUsPhFcElVRgA7v X-Received: by 2002:a65:5641:: with SMTP id m1-v6mr8649523pgs.246.1531544538587; Fri, 13 Jul 2018 22:02:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531544538; cv=none; d=google.com; s=arc-20160816; b=Qbyf2ptxDXFSnPqjoThSliqbvmIeY0sAJx6MUszFr+RMUYOuq0q1VIrDz81zEwSneX 7ibNolXWdwmd8YuwXJGZUV6AwH9uxxMXlJZu7Y+UIhkbmvABP3TSwtm4YZhj8bxkSoFU mgcqUgcerb9yT0HSmci+kzDXHV/Oh0Xutua3llowNEwXKam3z95U9atVJmzLf4HWuua9 AiHBZgtdKgoOQDMDXGvutcSehRj1CZ5JK3mEXZOwBfgKD/OHzE8ISVWlS7NZ4RDQvPmm lQ9HIlYr8R/xa4TNTp6dCcCvTUA5I/C3avGJuH/0V9QyK9TG8jt20FdRTt3/uuirOXr9 Pzzg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:cc:to:from :subject:arc-authentication-results; bh=GNOsx5YJzxQQjTwGV0VFejLa9btitL4KuWz+3IGePno=; b=l6SV5MfgUmCe+t1F1gW0QY0ZbJgwaA0i0qrRqk7Mu/HdWcUUpNNlCuPs1ZtkE6Jpx9 AEic8NXLa3LAYlK/LrZGrTsxkjK1pDs/pVxS9YSQsMjBpnc2f3EXZYoesBZZBsHFWylR Vrs1VEUyVE/pT1vrlelU62nH9AEMjuOIf+CeKsBTZ9MRaDxDtMDLREZtK9eZO8MKwGPN De9EJ+Q1lNW6JmfkE4oxgbvsPzfZPZuIZKIBZsrELIzZRl9gRDQFQLP/TdrtutactuR0 Cx6I/BWr9LvmdGggitL6UbFTsd33/8nFW7llC3ptMuY5C2UiLf5lqtHKPr2eiuLlEWjK RQiA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3-v6si26076185plf.84.2018.07.13.22.02.03; Fri, 13 Jul 2018 22:02:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729350AbeGNFSW (ORCPT + 99 others); Sat, 14 Jul 2018 01:18:22 -0400 Received: from mga11.intel.com ([192.55.52.93]:40757 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbeGNFSV (ORCPT ); Sat, 14 Jul 2018 01:18:21 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 22:00:10 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,350,1526367600"; d="scan'208";a="72663942" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga001.jf.intel.com with ESMTP; 13 Jul 2018 21:59:59 -0700 Subject: [PATCH v6 06/13] mm, dev_pagemap: Do not clear ->mapping on final put From: Dan Williams To: linux-nvdimm@lists.01.org Cc: stable@vger.kernel.org, Jan Kara , =?utf-8?b?SsOpcsO0bWU=?= Glisse , Andrew Morton , Ross Zwisler , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Fri, 13 Jul 2018 21:50:01 -0700 Message-ID: <153154380137.34503.3754023882460956800.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <153154376846.34503.15480221419473501643.stgit@dwillia2-desk3.amr.corp.intel.com> References: <153154376846.34503.15480221419473501643.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org MEMORY_DEVICE_FS_DAX relies on typical page semantics whereby ->mapping is only ever cleared by truncation, not final put. Without this fix dax pages may forget their mapping association at the end of every page pin event. Move this atypical behavior that HMM wants into the HMM ->page_free() callback. Cc: Cc: Jan Kara Cc: Jérôme Glisse Cc: Andrew Morton Cc: Ross Zwisler Fixes: d2c997c0f145 ("fs, dax: use page->mapping...") Signed-off-by: Dan Williams --- kernel/memremap.c | 1 - mm/hmm.c | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/memremap.c b/kernel/memremap.c index 5857267a4af5..62603634a1d2 100644 --- a/kernel/memremap.c +++ b/kernel/memremap.c @@ -339,7 +339,6 @@ void __put_devmap_managed_page(struct page *page) __ClearPageActive(page); __ClearPageWaiters(page); - page->mapping = NULL; mem_cgroup_uncharge(page); page->pgmap->page_free(page, page->pgmap->data); diff --git a/mm/hmm.c b/mm/hmm.c index de7b6bf77201..f9d1d89dec4d 100644 --- a/mm/hmm.c +++ b/mm/hmm.c @@ -963,6 +963,8 @@ static void hmm_devmem_free(struct page *page, void *data) { struct hmm_devmem *devmem = data; + page->mapping = NULL; + devmem->ops->free(devmem, page); }