From patchwork Mon Jun 4 23:12:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10447449 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E65EE603D7 for ; Mon, 4 Jun 2018 23:22:01 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D7ECB29210 for ; Mon, 4 Jun 2018 23:22:01 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CBA2929226; Mon, 4 Jun 2018 23:22:01 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E72829210 for ; Mon, 4 Jun 2018 23:22:01 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 591B36B0010; Mon, 4 Jun 2018 19:22:00 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 541A76B0266; Mon, 4 Jun 2018 19:22:00 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 40A3A6B0269; Mon, 4 Jun 2018 19:22:00 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f69.google.com (mail-pg0-f69.google.com [74.125.83.69]) by kanga.kvack.org (Postfix) with ESMTP id EF8AE6B0010 for ; Mon, 4 Jun 2018 19:21:59 -0400 (EDT) Received: by mail-pg0-f69.google.com with SMTP id z20-v6so95085pgv.17 for ; Mon, 04 Jun 2018 16:21:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:from :to:cc:date:message-id:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=uFUJdjyQq2G0/3aoLHOFuzkl4AadZe++CXfDmvwHwGw=; b=g5MNxx/lnE+PR0A33pnQjMXNP7+k3PzcEo+UoC5LDzV1Q4Iv/pgB+Iehd5cQjKmRep JQ/4sGA+tZ7H8A8v/6wktHCHMX7F8RaKsr2shkNqWEkNvIpgrxuvGcR6svyAW7nfzCe2 Ym3MriQ0qxsQiE+LVjgn7LFzDFOSK3m60V9U/xRtxSmLnnoCalcv3d0O84Pp88adfd3f jPhovgk2QrRXmXqFH4Wzoca2vrYVAJSFCfjgjt8qaVIsjfGhoy1rLdS1vxbgtLr9TT5Q TSCnrO09PcwReiGyRTF3/gbLECBMoo/6o9m3s376xxIJrmPfbRZVrVH0fxmTO2S7KHA1 RT/w== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Gm-Message-State: ALKqPwdZPwGoH/mRFDvA0JBL8lv1oEEJ4gAe3O/rWV0PikuGpHH/05QX g1bo0i5Dy+5VMfGTZE08BauUDpv7ItZE8KLvRMg7szgDo0tUZT9i4ptIqm5xED7PJzlvj/zPDcI /C/69TiWKCKx9ZBfpzi/4kokRLHoNjbngjV8s9Nz/doqcWx0zlPnhDZWdYQ58oj0uhw== X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr23464472pls.342.1528154519678; Mon, 04 Jun 2018 16:21:59 -0700 (PDT) X-Google-Smtp-Source: ADUXVKJtbY88B6HC36qyjojwZVjYnfsSV+fEYeXjYqUpSAoVBy3Z15vMmuyy7MjlxSLiDDyKeVvI X-Received: by 2002:a17:902:bd93:: with SMTP id q19-v6mr23464430pls.342.1528154518936; Mon, 04 Jun 2018 16:21:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528154518; cv=none; d=google.com; s=arc-20160816; b=lAkKrqzU3ADcqRqyORkLSlAsaWgiXN1YyF40bEm5SzC8qjujTOIAudKlY8OlGbMXd4 gwP2XmflSYmDbkCpWT/G53vak198tVNpLrT3WXqf7rdZ+zfldO4Ai+1arXV41LdhiZD4 JPEUYTCCPHPAC7Rs1udLgDJd/FCVpfg19pzsJLj08VDeZt8RAcN6cRryalVcJo36+lQY MC7MjTF62bxzxnnlKDQ1Xc4UD8InqtUdZthawKC6O220f0xJCutmRt+n5Y4TLHUoEPyl cmKSCZDZMRAEvi9BVcFS9u8FQYcAcHNlFzwjiCCY+XiVLsDCPIxg3939M0JsqtAj1o1A +jXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:user-agent:references :in-reply-to:message-id:date:cc:to:from:subject :arc-authentication-results; bh=uFUJdjyQq2G0/3aoLHOFuzkl4AadZe++CXfDmvwHwGw=; b=bh7cDrywYtWxYvquGQCJ79hfIMK6+aRb2WbMx4LZIfB5xcby8YFPDzSJimTJXf77y1 l8N9TnzfsuAzPXOTdnjmClB2pqm+6R45GI84T5y+L4ngR98XXa3Dg0UzX9gnFBYG8dBD rRR9/rEiaaZ6wmO2OpWinUukDys1k3mOrzcaAKLvTDlPBw5BaB/fRQ4hLmb3ttJjGcpR v7s3Cc+oKDjl12sTig5DrZB9Jwg8a6nP79HWlzN40AypXqakDD81xx6NXIJyCsBn7QsV Ti+iIMUFYOmlnouPfd6N46OvEw86V3XF1aCChYCnGgdUm4jSsM1yCOAjfaF1xP5lddal xKkQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga11.intel.com (mga11.intel.com. [192.55.52.93]) by mx.google.com with ESMTPS id d16-v6si8954125pli.201.2018.06.04.16.21.58 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 04 Jun 2018 16:21:58 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) client-ip=192.55.52.93; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 192.55.52.93 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 04 Jun 2018 16:21:58 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,477,1520924400"; d="scan'208";a="60359907" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga004.fm.intel.com with ESMTP; 04 Jun 2018 16:21:58 -0700 Subject: [PATCH v3 04/12] device-dax: Set page->index From: Dan Williams To: linux-nvdimm@lists.01.org Cc: hch@lst.de, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, jack@suse.cz Date: Mon, 04 Jun 2018 16:12:01 -0700 Message-ID: <152815392126.39010.6403368422475215562.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152815389835.39010.13253559944508110923.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152815389835.39010.13253559944508110923.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-2-gc94f MIME-Version: 1.0 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP 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. Signed-off-by: Dan Williams Reviewed-by: Jan Kara --- drivers/dax/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index 7ec246549721..2b120e397e08 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -418,6 +418,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 @@ -425,6 +426,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(vma, vmf->address + & ~(fault_size - 1)); for (i = 0; i < fault_size / PAGE_SIZE; i++) { struct page *page; @@ -432,6 +435,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);