Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp209802imm; Fri, 13 Jul 2018 22:00:45 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcKb5Lls/SRC8QVozHIt0Sy+HlohlIy1nOsmiS7aw/dRZOHBOBvkT2248HaOf8nHxJk4cfD X-Received: by 2002:a62:5cc1:: with SMTP id q184-v6mr9806115pfb.241.1531544445445; Fri, 13 Jul 2018 22:00:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531544445; cv=none; d=google.com; s=arc-20160816; b=aG9J8nUWYrRlD3L/Y4p4/nILr15ebgLe1CdI1FccgGZI1ZQws/KEHua23WSP//vmGw NKb4n2uoVRQ2beOLPwJDFXVMw4LfSNQsDCoHuwg2g+/0Gso+iRpfil9yEEimutMmeWVn VzGP2dJKxBkXR7rzkioHBu8quEdmzR4Rruez1ld5hmYHrDCis9an0cyiyLovo6Dxwb0o ihgRE7PRIyDKdiecMLhLE/NXP5xTaAmR+/AgNX6FuK7X3DkvrWcmu1W1rFsQtOb/F6tp qOPItBShQcJzxjxtlGaTaF8eYaUnM55uqCQ7HjBMGzR2pTxOiDH+PZyU0T6Id1lZvV9k Gfvg== 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=EQDufybVCAJcCn6LK6mWfblSUCoXXSZOigO5JO3c188=; b=aPVhod59ARuPGcgmiI2HM97Vob3G3Nm2u0nHCmD/lFqabyztYV2iSqpJBFhEDAH/2C 60M3rhuA8cAHxgszKQrh6txDoOhP5bK7SoN3G+mCEj9LguNLAJfP0pOgz7cGnEZYmiuz /kkmzgjmZ+Q0KwssHf7smgYyyWKniG5FdaarqaVcmkHhHP0tdvwnP74bDYb7li1wTuAT b2/V5DT4j13TBNiQJSwwSeOvbEV/aXD7b7zGeOt4IgloPZ3oLiPp4KyrxfFVNfdF4CL1 NGUVGmAW5NK9iV5F8ujmconlmHW5yJqQ2yC7DqXbMyxdLy4HdbHaGp9qR4w/CvMvud3p V/Ng== 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 y8-v6si6791033pfe.269.2018.07.13.22.00.30; Fri, 13 Jul 2018 22:00:45 -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 S1726936AbeGNFRY (ORCPT + 99 others); Sat, 14 Jul 2018 01:17:24 -0400 Received: from mga02.intel.com ([134.134.136.20]:43162 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725880AbeGNFRX (ORCPT ); Sat, 14 Jul 2018 01:17:23 -0400 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Jul 2018 21:59:43 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.51,350,1526367600"; d="scan'208";a="64603295" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by FMSMGA003.fm.intel.com with ESMTP; 13 Jul 2018 21:59:43 -0700 Subject: [PATCH v6 03/13] device-dax: Set page->index From: Dan Williams To: linux-nvdimm@lists.01.org Cc: Jan Kara , hch@lst.de, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org Date: Fri, 13 Jul 2018 21:49:45 -0700 Message-ID: <153154378540.34503.13530001843688931438.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: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In support of enabling memory_failure() handling for device-dax mappings, set ->index to the pgoff of the page. The rmap implementation requires ->index to bound the search through the vma interval tree. The ->index value is never cleared. There is no possibility for the page to become associated with another pgoff while the device is enabled. When the device is disabled the 'struct page' array for the device is destroyed and ->index is reinitialized to zero. Reviewed-by: Jan Kara Signed-off-by: Dan Williams --- drivers/dax/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 95cfcfd612df..361a11089591 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -416,6 +416,7 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, if (rc == VM_FAULT_NOPAGE) { unsigned long i; + pgoff_t pgoff; /* * In the device-dax case the only possibility for a @@ -423,6 +424,8 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, * mapped. No need to consider the zero page, or racing * conflicting mappings. */ + pgoff = linear_page_index(vmf->vma, vmf->address + & ~(fault_size - 1)); for (i = 0; i < fault_size / PAGE_SIZE; i++) { struct page *page; @@ -430,6 +433,7 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, if (page->mapping) continue; page->mapping = filp->f_mapping; + page->index = pgoff + i; } } dax_read_unlock(id);