From patchwork Tue May 22 14:39:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 10418767 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 0CD3960224 for ; Tue, 22 May 2018 14:49:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0DB628D05 for ; Tue, 22 May 2018 14:49:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E55E228D13; Tue, 22 May 2018 14:49:52 +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 886E528D05 for ; Tue, 22 May 2018 14:49:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D3FB46B0008; Tue, 22 May 2018 10:49:50 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D17566B000A; Tue, 22 May 2018 10:49:50 -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 C2DE66B000C; Tue, 22 May 2018 10:49:50 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pl0-f72.google.com (mail-pl0-f72.google.com [209.85.160.72]) by kanga.kvack.org (Postfix) with ESMTP id 8331E6B0008 for ; Tue, 22 May 2018 10:49:50 -0400 (EDT) Received: by mail-pl0-f72.google.com with SMTP id u7-v6so12350250plq.3 for ; Tue, 22 May 2018 07:49:50 -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=/3+zb0AwVMXdNvf4KDTI1pzLe7pDvRou7hMOTuNE0U8=; b=J7hBUwwqX0FqeUI6fH6bWqKdaamrTMQePW8OsK2RmRYtDtFmLP5sPw9Vc3rZ69ifzW 1ep3EV0URBU2Bg+WhQJ+N6BxC+fZHsG4uelbuYSu2CwgFRTypn40uwl7vaJAp0bF6Dbc CHN7GlfEEO5AL/FtHEAR/YEEnt8hx1OLIQ4r0wV+tOoS/kK08qk24Z35P4p3gaDX3G2G qJBz5bn9xEdF9nRRNZj//Q1jzWiAnCJaLgVlxD0o2XH0k3QivnlZrTd9uNTaFpueED1d qCB5eBaJ6lHU0P7Da68PR2ljA/vtwyXPZeDkrH4ve5V9PIYhFszp282ajddCgA58DVDq hAKg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.20 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: ALKqPwfqgBZ5HijBMPCMPfATsgJo12BZQfIo5cPN5vqxBI+KpbDdZGDA eCaYkBAzjUFOCWHtka39uK93mlLIEdsySrs9KePqPXTt5Bx2e+z2jyQbCOSWdHohQQHumqoj/Td TssXt2CffbT7dlpoy220LjcmGjBjb9uThAneEN2g7sobfr4gdaZKMydv6m+HCZv5mZg== X-Received: by 2002:a17:902:76c1:: with SMTP id j1-v6mr24760802plt.284.1527000590243; Tue, 22 May 2018 07:49:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrKN+hV7n3XVlL+AV6/FN2RefwPNpHvCIFj+fDUbgKqouaggFBfyNchthH9LR1Aape8C9rr X-Received: by 2002:a17:902:76c1:: with SMTP id j1-v6mr24760772plt.284.1527000589588; Tue, 22 May 2018 07:49:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527000589; cv=none; d=google.com; s=arc-20160816; b=yuLBFKcVg+nFhv3voniW531FXWZ/xssajrC5F5iUi6aS7SwVXQ4lFb7UuOy2nU5BKf CZ3xtoUjp2lmMtq7dhgSEOf0R8t782CULGlsqKsqQPxiCmuF2InSG4gnRvQj/eJrC7S8 sy3N+SbRt4y/ex1xCtGdmhbq6XJU1gahBLz5TGVtN2FfHUj+ppybyJPLXCfnjv/c7p3A fFX+qRpK+RnNYXw1R/xDt7FqDg3cdhXH8XOs83JxgjeytqPWglbdCaID6bpoG2CdGT/D Z9feu0jWzTAmpLb7TaBfMNeu3U39jsTFev+tMxRqnsLw7YtapYKGhZnrV2tt9tcXEWJ+ jQUA== 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=/3+zb0AwVMXdNvf4KDTI1pzLe7pDvRou7hMOTuNE0U8=; b=sa0IjLhXkFxAXQ86K+W3uKHr1t9nAQmLYeQkdYll/VbFtuWNCcjYEIcrCnPCCoEdNl E53qMz6VfmnZyN58ASGuCFwfyU80LYpsSRzQAhErF6coJ5qAN4dsBNhadd2GABWBmUlR zb9mYF0HHDrLII2ZENdO5OHEq9VvpMi0wpBqRyBTOpPGHid7dG+2LkcftYmDbld1qf+q 9nhrY5lJeY4V1jlNO6KKwp2Y1/Wua8PLO6MKJSGDPUxieGU7DbdeChxMy8Z3ywXiOcQr q/MbfT/qN7D3KA9ZHb3pszpmIG01/4QTDUjDg3HI3RCwdxszlZCgzRuXf8ZZegayuFDc waVA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.20 as permitted sender) smtp.mailfrom=dan.j.williams@intel.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from mga02.intel.com (mga02.intel.com. [134.134.136.20]) by mx.google.com with ESMTPS id bc11-v6si16081889plb.544.2018.05.22.07.49.49 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 22 May 2018 07:49:49 -0700 (PDT) Received-SPF: pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.20 as permitted sender) client-ip=134.134.136.20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of dan.j.williams@intel.com designates 134.134.136.20 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 orsmga004.jf.intel.com ([10.7.209.38]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 May 2018 07:49:49 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,430,1520924400"; d="scan'208";a="201487322" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.16]) by orsmga004.jf.intel.com with ESMTP; 22 May 2018 07:49:49 -0700 Subject: [PATCH 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, tony.luck@intel.com Date: Tue, 22 May 2018 07:39:52 -0700 Message-ID: <152699999266.24093.18001031234939470569.stgit@dwillia2-desk3.amr.corp.intel.com> In-Reply-To: <152699997165.24093.12194490924829406111.stgit@dwillia2-desk3.amr.corp.intel.com> References: <152699997165.24093.12194490924829406111.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 8e986478d48d..b33e45ee4f70 100644 --- a/drivers/dax/device.c +++ b/drivers/dax/device.c @@ -418,7 +418,10 @@ static vm_fault_t dev_dax_huge_fault(struct vm_fault *vmf, if (rc == VM_FAULT_NOPAGE) { unsigned long i; + pgoff_t pgoff; + pgoff = linear_page_index(vma, vmf->address + & ~(fault_size - 1)); for (i = 0; i < fault_size / PAGE_SIZE; i++) { struct page *page; @@ -426,6 +429,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);