From patchwork Sat Jul 14 04:49:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10524487 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 DB1FD602B3 for ; Sat, 14 Jul 2018 04:59:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C9E9A288CA for ; Sat, 14 Jul 2018 04:59:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE14F29571; Sat, 14 Jul 2018 04:59:46 +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=ham 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 4D98D288CA for ; Sat, 14 Jul 2018 04:59:46 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5F52D6B000D; Sat, 14 Jul 2018 00:59:45 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 576D76B000E; Sat, 14 Jul 2018 00:59:45 -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 3F1106B0010; Sat, 14 Jul 2018 00:59:45 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f70.google.com (mail-pl0-f70.google.com [209.85.160.70]) by kanga.kvack.org (Postfix) with ESMTP id EE0196B000D for ; Sat, 14 Jul 2018 00:59:44 -0400 (EDT) Received: by mail-pl0-f70.google.com with SMTP id g15-v6so10075072plo.11 for ; Fri, 13 Jul 2018 21:59:44 -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=EQDufybVCAJcCn6LK6mWfblSUCoXXSZOigO5JO3c188=; b=Xs5NOeZ4s3ZoqDvuYBiE4za5AtTb0bLhJKvFbaeujWBklI9gEe62Hg+4lo2R5gVlwX cHL5OKWaYyTyXy1eajKYsILyQKTs2TMfwZEmvAQvVJDunlbnR3WTRnfrz7lZLxj/JQKh S8+2JRGc6v5JPkaAh+xPPa39iScdquiz3hJakvbqIKgTF5sk37jkYuC47bpsrOmn+yr7 mIRz97ERROawrX8aWe46LWqWox2XS8jc8czPnoJ/eD98+oKlDz4mZK+sD1fvLu+sINQN Hx4yLTHWz9oeWvG3lBS/DFHi2P+nSP74pH+GtXeYql5t7rl08Ecvt6loSbgocYpPAC93 BqHw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 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: AOUpUlE56wEpwDVoSfci69Khlypcr/ey6YM/u53apKcfWJSht4bOoHT4 1L62f1ax7wUjoh9Tfv7jkLq6DU2P7WGLDixm6+1VSrmn3zB7ezmNyzUh9IRiAXNHuRflShzHovb OButR36x9oFgVsDm0riw3VA47js+4WIrrWko9Pv8iel9cUXXlyvqUWX6r57VurGe7WA== X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr9857770pfn.77.1531544384658; Fri, 13 Jul 2018 21:59:44 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc+LmJ+/caEFFDtRhdvLmEe8say5Qq2oO+NoMg9AOTwV+I5Xoz3hlan8yc7D9kkaBaz+D6p X-Received: by 2002:aa7:8591:: with SMTP id w17-v6mr9857747pfn.77.1531544383782; Fri, 13 Jul 2018 21:59:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1531544383; cv=none; d=google.com; s=arc-20160816; b=ygFaN/T2yoVQ8Ym3DFa+WNvbfMOL7drAY8vE1tnOoT9ZaYCLpd2qUsXsvqCAxNM4rk WSVAEjn4ase9IpAQWrwAGxHJHHIhAbRcaEnsdkN7f6S1gZYhsKTwnVvS3UQTt0xQ7h3v eF0q81Qee1THtFoDGEt7KhgkJNPtblBQLwYcM2gRlnLIxHIIwN87+b40V7MSt7/6BoMg 8/oLn+xUJF1c/j2C3JtL29N5LGnEYtTJAyYBjK1Gi7EakhZQUuazI7ofaCa1REL3re5h BKXHp3YA38wZvYgubFu4RGhf1geISw79rATJxeouN8JQx5cT/Y474RH5i4BYrAqDrm/X LgEQ== 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=EQDufybVCAJcCn6LK6mWfblSUCoXXSZOigO5JO3c188=; b=iOM4/kXGWSs7aqTAA9iCTNNx0U/AHD2bqsK31Qf2F74ysGAzZNLgvBQ1R3ZvRY7gVE ecYQvV66oEs7lz6cemXAQYN5WDCEHavBwIsmmzVUMpJ2MU719ziRr8fSEwLjNljzcqOT UmH5L0THJgkYUVYnIj4/1DBFPPBbYvFCpl1PKkYcCW/teT3PWgXwMHs8p+i+yj9Et6MQ MjqY0qSta2cjFi7MBGZQyNhsdnmtVpxKywMY6XboRgJWBf4H3XOzd1zNlH7fCj2jpIc0 KubraF8mN1i+XHbwD4h700fKMbO30QsEtq/OVtnRMPxn26S3OsMb1edaah/xmxCWQLKE oK4g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga06.intel.com (mga06.intel.com. [134.134.136.31]) by mx.google.com with ESMTPS id q145-v6si5569018pfq.315.2018.07.13.21.59.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 13 Jul 2018 21:59:43 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 as permitted sender) client-ip=134.134.136.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.31 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 fmsmga003.fm.intel.com ([10.253.24.29]) by orsmga104.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 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. 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);