From patchwork Sun Jun 3 05:23:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10445171 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 AD50F602BC for ; Sun, 3 Jun 2018 05:33:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A004E289D6 for ; Sun, 3 Jun 2018 05:33:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 94C9928AFB; Sun, 3 Jun 2018 05:33:05 +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 4A009289D6 for ; Sun, 3 Jun 2018 05:33:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2BB4B6B000E; Sun, 3 Jun 2018 01:33:04 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 266896B0010; Sun, 3 Jun 2018 01:33:04 -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 108C56B0266; Sun, 3 Jun 2018 01:33:04 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pf0-f199.google.com (mail-pf0-f199.google.com [209.85.192.199]) by kanga.kvack.org (Postfix) with ESMTP id C264A6B000E for ; Sun, 3 Jun 2018 01:33:03 -0400 (EDT) Received: by mail-pf0-f199.google.com with SMTP id z1-v6so16934056pfh.3 for ; Sat, 02 Jun 2018 22:33:03 -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=5CJ/26/tYrJm5XU9d7aNQCdbTpcobrqFHfxVe6JX5TM=; b=lqleKM0wWQduk8w3nXjrixs23koQRZEwxTXp9lVwdKF0Abdd0TCqy/nE8PP/WuoXAs 03UCajiJoJY3X9NIWkVVxIIXRrsjTcnDItcGr2FUAR9sZyvpScv8ACDKbqWyq4PtttrY +6roL9/4zyFBO8+jPsir//kTc3mrqlgpfJ8cxAp8Np+SsbSm4HO6ueQoaaMe6vJEP7KW IZoaa+9gFRXUkJ//9QIi45hhPIlHTx/a/kceLAI7BTsWcFRxr9YOmGut46I2Vpzpm27j FNPVy7xrAlUMBsd849L35Lu4qnLiduG1lZlH4s8BpgZf0id3D4osN97YYzgUK63JfNTk GGlA== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.65 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: ALKqPwd7+/CCb8JWBTnPOrT+5T9ysUR+AcBqZZAsjmzOGMW81ifEF0nu TjmLgQ102nKwhQewgkS0K2Z3efJR8Fcm+vOvV+1VJw2oSPwFRMSB2tzf1BvCrN63EdDgWJ3tijY vCcAVjACVy8lanwxRLYSuEggvl0Ic3kpiy6AcTvmJ6KqCp7aUvDJhYxQMErQSfxTa3w== X-Received: by 2002:a63:6096:: with SMTP id u144-v6mr13449289pgb.433.1528003983426; Sat, 02 Jun 2018 22:33:03 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKazaRskQ7V/1UtLuJOGjZt+NDBjzK7SxhbN8s3XiEUZvE/EDxhGsgGDAQQXt3mONwzHeaq X-Received: by 2002:a63:6096:: with SMTP id u144-v6mr13449261pgb.433.1528003982774; Sat, 02 Jun 2018 22:33:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528003982; cv=none; d=google.com; s=arc-20160816; b=LjxSZZxOs1uhsCmogtI84uag3StwfhRELZV6KNfFrsQR0pM0VRtUj6wK1fm3Jp3MGr PWZkl/s/Bn+skhQu60593ziYieVikLmwrh+sPEM6CKorSoq0EARJtHBWs4mES7Dne+KF BD+hvyue75RQRJrBVNExc67U+WrsEFjm8/MDlxswbwgcPWMkKa3reLjOTOQmZp3Bb9wU FbFygBz+1InmVsmERbrPEyCzO9nSgf6q0Kh2aLe+UR36zet3n7YBK9eIuiBHqo+6jQ2v cwCzY1hlXSSCjYrLSXX6l2v75+UQ+ygMA3qMF4bQuzqIyJZHE4wd0Kh4T6pJUpwWYKKt Z7/A== 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=5CJ/26/tYrJm5XU9d7aNQCdbTpcobrqFHfxVe6JX5TM=; b=TFMHSxUhRsjjF55rnyozi0mdBym5PFAGo20260uzXSHAGqAvp83oGu0EXo7njYmli2 9A7uywQUrBpokym88jKyjiFcxXEUV+cxhKRJ9+JhROB3NuO6+1RgOAdB4WY8dKOj6b52 vI7cr6m//K9vL+kk7y/eGq2PzZiL1ED5hofgWowsgrnRjlKdecjTdYhZdylIW1M3jPbP mKS4SxQV6eemmooRGUG4LHtcVw1iIbzzKTAKKEiQtqdIpN/k6F9Y9U2yUTNFdtIKGGYY kpcAIo7+1AWz0ykq7NhJguPSxFsojlwdDcHDd0diuPW275C/tAM2dfhZ7Bo1In6p9eui /KHQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.65 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga03.intel.com (mga03.intel.com. [134.134.136.65]) by mx.google.com with ESMTPS id f3-v6si42922912pld.513.2018.06.02.22.33.02 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jun 2018 22:33:02 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.65 as permitted sender) client-ip=134.134.136.65; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.65 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 fmsmga008.fm.intel.com ([10.253.24.58]) by orsmga103.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Jun 2018 22:33:02 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,472,1520924400"; d="scan'208";a="44852503" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by fmsmga008.fm.intel.com with ESMTP; 02 Jun 2018 22:33:02 -0700 Subject: [PATCH v2 04/11] 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: Sat, 02 Jun 2018 22:23:05 -0700 Message-ID: <152800338510.17112.13056836346500332623.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152800336321.17112.3300876636370683279.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152800336321.17112.3300876636370683279.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 --- drivers/dax/device.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/dax/device.c b/drivers/dax/device.c index f7e926f4ec12..499299e36ee2 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);