From patchwork Tue Jan 12 09:34:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dan Williams X-Patchwork-Id: 12012891 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7B63CC433E6 for ; Tue, 12 Jan 2021 09:34:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id D48C422E00 for ; Tue, 12 Jan 2021 09:34:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D48C422E00 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=intel.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D17678D007C; Tue, 12 Jan 2021 04:34:40 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CC7228D0051; Tue, 12 Jan 2021 04:34:40 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C049B8D007C; Tue, 12 Jan 2021 04:34:40 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0049.hostedemail.com [216.40.44.49]) by kanga.kvack.org (Postfix) with ESMTP id AA4438D0051 for ; Tue, 12 Jan 2021 04:34:40 -0500 (EST) Received: from smtpin17.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 6E63383F6 for ; Tue, 12 Jan 2021 09:34:40 +0000 (UTC) X-FDA: 77696613120.17.work92_480467727514 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin17.hostedemail.com (Postfix) with ESMTP id 444A7180D0186 for ; Tue, 12 Jan 2021 09:34:40 +0000 (UTC) X-HE-Tag: work92_480467727514 X-Filterd-Recvd-Size: 4231 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by imf21.hostedemail.com (Postfix) with ESMTP for ; Tue, 12 Jan 2021 09:34:38 +0000 (UTC) IronPort-SDR: ZZZ8fihuQSWdQcE96PyFp47rUd4f27wS/r/m0jq7v545hWjipX8trc2e0tW8w0a1/5ndbnymYc PeOwvQlzEEaw== X-IronPort-AV: E=McAfee;i="6000,8403,9861"; a="174503022" X-IronPort-AV: E=Sophos;i="5.79,341,1602572400"; d="scan'208";a="174503022" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2021 01:34:37 -0800 IronPort-SDR: B4o+/ciPzlr45jWPFCMxT/2CPpQmmQQCCI4RCNc6hkk4ShdXdoYjAaUysR+2M53gnVdca6eSyz b9FQAcucoTBg== X-IronPort-AV: E=Sophos;i="5.79,341,1602572400"; d="scan'208";a="464460801" Received: from dwillia2-desk3.jf.intel.com (HELO dwillia2-desk3.amr.corp.intel.com) ([10.54.39.25]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 12 Jan 2021 01:34:36 -0800 Subject: [PATCH v2 0/5] mm: Fix pfn_to_online_page() with respect to ZONE_DEVICE From: Dan Williams To: linux-mm@kvack.org Cc: David Hildenbrand , Dave Jiang , Ira Weiny , stable@vger.kernel.org, Naoya Horiguchi , Qian Cai , Michal Hocko , Oscar Salvador , Michal Hocko , Vishal Verma , Andrew Morton , linux-nvdimm@lists.01.org, linux-kernel@vger.kernel.org Date: Tue, 12 Jan 2021 01:34:36 -0800 Message-ID: <161044407603.1482714.16630477578392768273.stgit@dwillia2-desk3.amr.corp.intel.com> User-Agent: StGit/0.18-3-g996c 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: Changes since v1 [1]: - Clarify the failing condition in patch 3 (Michal) - Clarify how subsection collisions manifest in shipping systems (Michal) - Use zone_idx() (Michal) - Move section_taint_zone_device() conditions to move_pfn_range_to_zone() (Michal) - Fix pfn_to_online_page() to account for pfn_valid() vs pfn_section_valid() confusion (David) [1]: http://lore.kernel.org/r/160990599013.2430134.11556277600719835946.stgit@dwillia2-desk3.amr.corp.intel.com --- Michal reminds that the discussion about how to ensure pfn-walkers do not get confused by ZONE_DEVICE pages never resolved. A pfn-walker that uses pfn_to_online_page() may inadvertently translate a pfn as online and in the page allocator, when it is offline managed by a ZONE_DEVICE mapping (details in Patch 3: ("mm: Teach pfn_to_online_page() about ZONE_DEVICE section collisions")). The 2 proposals under consideration are teach pfn_to_online_page() to be precise in the presence of mixed-zone sections, or teach the memory-add code to drop the System RAM associated with ZONE_DEVICE collisions. In order to not regress memory capacity by a few 10s to 100s of MiB the approach taken in this set is to add precision to pfn_to_online_page(). In the course of validating pfn_to_online_page() a couple other fixes fell out: 1/ soft_offline_page() fails to drop the reference taken in the madvise(..., MADV_SOFT_OFFLINE) case. 2/ The libnvdimm sysfs attribute visibility code was failing to publish the resource base for memmap=ss!nn defined namespaces. This is needed for the regression test for soft_offline_page(). --- Dan Williams (5): mm: Move pfn_to_online_page() out of line mm: Teach pfn_to_online_page() to consider subsection validity mm: Teach pfn_to_online_page() about ZONE_DEVICE section collisions mm: Fix page reference leak in soft_offline_page() libnvdimm/namespace: Fix visibility of namespace resource attribute drivers/nvdimm/namespace_devs.c | 10 +++--- include/linux/memory_hotplug.h | 17 +---------- include/linux/mmzone.h | 22 +++++++++----- mm/memory-failure.c | 20 ++++++++++--- mm/memory_hotplug.c | 62 +++++++++++++++++++++++++++++++++++++++ 5 files changed, 99 insertions(+), 32 deletions(-)