From patchwork Wed Nov 14 21:16:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10683093 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 279B314BA for ; Wed, 14 Nov 2018 21:17:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AADB2B6B5 for ; Wed, 14 Nov 2018 21:17:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D5CD2B9C6; Wed, 14 Nov 2018 21:17:27 +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 9F5042B6B5 for ; Wed, 14 Nov 2018 21:17:26 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 05E3C6B0003; Wed, 14 Nov 2018 16:17:25 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 00D976B0005; Wed, 14 Nov 2018 16:17:24 -0500 (EST) 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 E3EAB6B0006; Wed, 14 Nov 2018 16:17:24 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by kanga.kvack.org (Postfix) with ESMTP id BE24D6B0003 for ; Wed, 14 Nov 2018 16:17:24 -0500 (EST) Received: by mail-qk1-f200.google.com with SMTP id l7-v6so40754687qkd.5 for ; Wed, 14 Nov 2018 13:17:24 -0800 (PST) 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:from:to:cc :subject:date:message-id; bh=VK8QYALPaT8YcJV3kFsU3p4/bU49MTOrVwBHWMcXFh0=; b=hjJBu/aTQ2/SHJkYkTgVGslTB+KKYEbOHiCkGEq4vXjczc48bPjAeD+05V6ohzPXzv HsMWnQZ8NBJrKauK28kRKxcU/4kyiMyd3S0XGl7Vh0C6UYbSPLSRZz/l53OOuZryPOGw +22sH7jJqPie8W9i4fT6krnnGumJQtcXQr0dXgm2KqamatXjt53WRMWq0hdmiRRU8FgL 7+DJRjD0AJOBf5vp1x0qS5m0VeFhyccIOm0DKVX+5ILzQOBmz7kqsOAG1PMxy1mql8AI sLhjUQpC8Gjsqk32jbbaSmvhEutiY3/Z9010byV0sVT4tyOK1m12Fiwv7t4Kbc7nX+0L hs+A== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Gm-Message-State: AGRZ1gIiMBmB2CP0UJtabGuHqRsijuF3CzeI2BxJyQM8ZbT2gQv/6DQk jsG+LI7tgxGxRpQArXM8aiKeFLNg1GWl2SEphqVp3mrE+M94ZPrzkbAZbyqCH1/pTezm5m4Hskp EXAp6zY8KNywLMPDqx2plNcKTVO8KqG4tnfmTvIthSMPpOSJZani01iekKV4HOoFGzA== X-Received: by 2002:aed:3aa7:: with SMTP id o36mr3434389qte.240.1542230244360; Wed, 14 Nov 2018 13:17:24 -0800 (PST) X-Google-Smtp-Source: AJdET5eDi2ryhKeZegWB+iO4ol2ETs9Wjrebuf1ZMDp62dbOzyVLpeMMOKnW8InuMDnvIOPDrPJl X-Received: by 2002:aed:3aa7:: with SMTP id o36mr3434329qte.240.1542230243279; Wed, 14 Nov 2018 13:17:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542230243; cv=none; d=google.com; s=arc-20160816; b=b3tKj/PhNs+RuzR6hTCzoOpFn6oLNXCk0lPqj1qCGwk5VDeycjbtHFgQXrPX7Bgngt 5FI0/Dr7Kl6yUiImGzT1nLp2WFenccopZg+F3YfHR+p6ebCh9ZPwPUpS76eP2am3KZfb zw0vdIdIYlMgsrW8PyZp23Uj/0omRWcpNniu1jtnkrFX81MNIGTKzEynSNhWkeqtIKqX 954nNRrNIABhSw0/kcCBd8+ro+OcWkBinkziCVngA3Nj9MJYJ4sVaBTup9LAdsaiJQoC Kg9QIQ194PfunAS1bZwuG2xZVfy3lWM1GwkMsNJFL2rN3MTi80cHlO3nOqWAfEQ5wxcs YDXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from; bh=VK8QYALPaT8YcJV3kFsU3p4/bU49MTOrVwBHWMcXFh0=; b=GY/plpNkddcH5Q1wBuyTwklcEVKl5/gdJInfJBaMK/TdD65GJqHBXLzPWvh8EuEFVo r1///DR3fkcrrzCDyhlcHal+np/6Boq0fHW/5Zg1E5iM6BNiyS2G6kOYj8q0Uuifw95X NrR2nt0wTZlRfVKROe9aMOy6jOtzC+FHjTl4P4fvScJcHfQ3kryMzH1HxroIQZbgHrY6 7lHcX+VlOTTIpnNa35YKGwb5WNAeDytG5LXLjJLnbieAdqK45U8FgJFnhnL8uO6ElFgn /F0+K7fV/zhZ/URVsgQvZO4RCVV/cYqR43X8bScE3qHL7+GyhqAjwERz9sDLgbNoBN32 w4YQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from mx1.redhat.com (mx1.redhat.com. [209.132.183.28]) by mx.google.com with ESMTPS id y6si1045343qvh.109.2018.11.14.13.17.22 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 14 Nov 2018 13:17:23 -0800 (PST) Received-SPF: pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; Authentication-Results: mx.google.com; spf=pass (google.com: domain of david@redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=david@redhat.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 090A193898; Wed, 14 Nov 2018 21:17:21 +0000 (UTC) Received: from t460s.redhat.com (ovpn-116-99.ams2.redhat.com [10.36.116.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3E8385F72B; Wed, 14 Nov 2018 21:17:04 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, devel@linuxdriverproject.org, linux-fsdevel@vger.kernel.org, linux-pm@vger.kernel.org, xen-devel@lists.xenproject.org, David Hildenbrand , Alexander Duyck , Alexey Dobriyan , Andrew Morton , Arnd Bergmann , Baoquan He , Boris Ostrovsky , Christian Hansen , Dave Young , David Rientjes , Haiyang Zhang , Jonathan Corbet , Juergen Gross , Kairui Song , "Kirill A. Shutemov" , "K. Y. Srinivasan" , Len Brown , Matthew Wilcox , "Michael S. Tsirkin" , Michal Hocko , Mike Rapoport , Miles Chen , Naoya Horiguchi , Omar Sandoval , Pavel Machek , Pavel Tatashin , "Rafael J. Wysocki" , Stefano Stabellini , Stephen Hemminger , Stephen Rothwell , Vitaly Kuznetsov , Vlastimil Babka Subject: [PATCH RFC 0/6] mm/kdump: allow to exclude pages that are logically offline Date: Wed, 14 Nov 2018 22:16:58 +0100 Message-Id: <20181114211704.6381-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.28]); Wed, 14 Nov 2018 21:17:22 +0000 (UTC) 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 Right now, pages inflated as part of a balloon driver will be dumped by dump tools like makedumpfile. While XEN is able to check in the crash kernel whether a certain pfn is actuall backed by memory in the hypervisor (see xen_oldmem_pfn_is_ram) and optimize this case, dumps of virtio-balloon and hv-balloon inflated memory will essentially result in zero pages getting allocated by the hypervisor and the dump getting filled with this data. The allocation and reading of zero pages can directly be avoided if a dumping tool could know which pages only contain stale information not to be dumped. Also for XEN, calling into the kernel and asking the hypervisor if a pfn is backed can be avoided if the duming tool would skip such pages right from the beginning. Dumping tools have no idea whether a given page is part of a balloon driver and shall not be dumped. Esp. PG_reserved cannot be used for that purpose as all memory allocated during early boot is also PG_reserved, see discussion at [1]. So some other way of indication is required and a new page flag is frowned upon. We have PG_balloon (MAPCOUNT value), which is essentially unused now. I suggest renaming it to something more generic (PG_offline) to mark pages as logically offline. This flag can than e.g. also be used by virtio-mem in the future to mark subsections as offline. Or by other code that wants to put pages logically offline (e.g. later maybe poisoned pages that shall no longer be used). This series converts PG_balloon to PG_offline, allows dumping tools to query the value to detect such pages and marks pages in the hv-balloon and XEN balloon properly as PG_offline. Note that virtio-balloon already set pages to PG_balloon (and now PG_offline). Please note that this is also helpful for a problem we were seeing under Hyper-V: Dumping logically offline memory (pages kept fake offline while onlining a section via online_page_callback) would under some condicions result in a kernel panic when dumping them. As I don't have access to neither XEN nor Hyper-V installation, this was not tested yet (and a makedumpfile change will be required to skip dumping these pages). [1] https://lkml.org/lkml/2018/7/20/566 David Hildenbrand (6): mm: balloon: update comment about isolation/migration/compaction mm: convert PG_balloon to PG_offline kexec: export PG_offline to VMCOREINFO xen/balloon: mark inflated pages PG_offline hv_balloon: mark inflated pages PG_offline PM / Hibernate: exclude all PageOffline() pages Documentation/admin-guide/mm/pagemap.rst | 6 +++++ drivers/hv/hv_balloon.c | 14 ++++++++-- drivers/xen/balloon.c | 3 +++ fs/proc/page.c | 4 +-- include/linux/balloon_compaction.h | 34 +++++++++--------------- include/linux/page-flags.h | 11 +++++--- include/uapi/linux/kernel-page-flags.h | 1 + kernel/crash_core.c | 2 ++ kernel/power/snapshot.c | 5 +++- tools/vm/page-types.c | 1 + 10 files changed, 51 insertions(+), 30 deletions(-)