From patchwork Fri Jun 8 23:50:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10455347 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 F361A60234 for ; Sat, 9 Jun 2018 00:00:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E56ED2955B for ; Sat, 9 Jun 2018 00:00:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6625295D3; Sat, 9 Jun 2018 00:00:51 +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 6353A2942B for ; Sat, 9 Jun 2018 00:00:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AE2336B000E; Fri, 8 Jun 2018 20:00:41 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id A68B96B0266; Fri, 8 Jun 2018 20:00:41 -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 909B56B0269; Fri, 8 Jun 2018 20:00:41 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg0-f70.google.com (mail-pg0-f70.google.com [74.125.83.70]) by kanga.kvack.org (Postfix) with ESMTP id 479466B000E for ; Fri, 8 Jun 2018 20:00:41 -0400 (EDT) Received: by mail-pg0-f70.google.com with SMTP id r8-v6so4556511pgq.2 for ; Fri, 08 Jun 2018 17:00:41 -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=+lHfrY1JqdbHIuIVZfBnMjVNMq0Xtb/QL1mO7275Lns=; b=iyonzSp+9O/hYC4jZr+cDE9tdy3RdwANNt3EUX09h9+FBGdOTqcxtKhMZHhngdCF1E 0lyjcyU/M/q0qo0vlf5dNm3d4Dw3mk0S8fetpyUqiM2i33kKQBQYSNuWK0m8UbJnGfdD TPErxp4PUn0tCuylILeRg3lgLIUSoFLJHLVra1+ZgbeXGhLpi+HFvtvc6KkB0piJEL3A pAlHCl/9gGPdPw/D+Ykff4EFNXr2TMZKisqcQ/2VaNTCV462g4WyZAnuj7Cquu4vZl/6 uRb2kvZo0e/j3ZrSRgYE+bkaje7rgNEMncRzTLNIFeXJp9yz3gBG2FNqKgBSe5fqSihU nCew== 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: APt69E0MeHW5MDjrbqp+ZnAL4KP/3CBysssTkNniLZiVsovEBqCbsdT6 8B01ayClQ/mY4cFeZ1gQupXPUzPJNUS39sqLPw2+sHxW0p/lAhJKtrcjnh54mydSKmZ5VKtop3/ bCKRgppMtAl4DUgZ+uCYlF/axTYHbn/jolDtZv4W63mPhdxIDNRbjDYyK3raJB0kf0A== X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr8630475pla.80.1528502440974; Fri, 08 Jun 2018 17:00:40 -0700 (PDT) X-Google-Smtp-Source: ADUXVKLo7OuwhSw11UFG9YEvhoj6+aIAaCLRpJAY5VezQcrkBnoR/TJyt/p1N/AjJ3uS6GusnwaO X-Received: by 2002:a17:902:a5:: with SMTP id a34-v6mr8630431pla.80.1528502440149; Fri, 08 Jun 2018 17:00:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1528502440; cv=none; d=google.com; s=arc-20160816; b=zQD6Va2pqt+D/+LQz5mER2nfY6st5cnsUofl9ohCWLBEqAmKQDhGnEQDO5Q80Mpf3F QULrnWb0NEORe4f8/EntYlnpe+TMZu6IAVU9TXJpO16D6Kly7Q7GRezi5Ig0Vd3sc0uI s1Mx7kGA/ldXW+gzsL7+/ZsRVIeYS8sPzZcEeNE7HNjNtlGHgOq1/nDYXDt0lfea4JQT KCWRGCd0eeAEMJZUuqQUY1uLKRM0DWv0szRkEzP/bOAMmQT2gxpCB7W8UcK7D8N1KbG2 CRFNHkgK3I5OXBBvpm+d9KqSxWPzveIO1KYsPk+MtXH1/rX9ldW22Mfxsh9MbYTOBAy4 7Ifg== 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=+lHfrY1JqdbHIuIVZfBnMjVNMq0Xtb/QL1mO7275Lns=; b=Ac6gI5qaLCZvlSEvwhAqip1xvb85KNqMm/jW7Y+E8TdajdBh3oz9tlYaht+ZqKH9Ai K/NmLuapqzTt3YTQCCGpD0HFNS54b5zM+8M4+hn320Q0fEUZb7DLgU7o8ToYOBpp7PIx BKd5VwrsSy2soeflCZIJ0dkjWX+GqzRTUGvxRIz3hy3GbohwwnQ/d2uYOYVCYMZcDyw0 MU3ax7FkSXnEeWmtLCmjSsX0fZU7fyGAyUo3mPniTPkH2tL0rqwwi/gAc+4n8C7hnR5m w82mpX5QgwhuV9yUXz1odR9gMcLZLrlrsFZkeEnOZQYulPvbEOmkaGxL0LSUqtSIavpN IvaQ== 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 u30-v6si26420305pgo.678.2018.06.08.17.00.39 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 08 Jun 2018 17:00:40 -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 orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 Jun 2018 17:00:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,492,1520924400"; d="scan'208";a="47594922" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga007.jf.intel.com with ESMTP; 08 Jun 2018 17:00:39 -0700 Subject: [PATCH v4 04/12] device-dax: Set page->index From: Dan Williams To: linux-nvdimm@lists.01.org Cc: Jan Kara , hch@lst.de, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, jack@suse.cz Date: Fri, 08 Jun 2018 16:50:42 -0700 Message-ID: <152850184244.38390.9412836755220715157.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152850182079.38390.8280340535691965744.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152850182079.38390.8280340535691965744.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 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);