Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9547944imu; Wed, 5 Dec 2018 06:36:20 -0800 (PST) X-Google-Smtp-Source: AFSGD/UOxh49apCuUJae11XIctgEjpGX10hDomx7maFmEfQCk4wymALxOhL8bfWxZRfQJREZDkfz X-Received: by 2002:aa7:81d0:: with SMTP id c16mr24373279pfn.153.1544020580497; Wed, 05 Dec 2018 06:36:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544020580; cv=none; d=google.com; s=arc-20160816; b=UqDlm1PbSU2lJ5/NuKc+sE3Uk4ABLx2LJ4QxudJc96ScLA5OURnF1FsmgWQ+OESoIn 1iGgQvzBCQK1dasKl2DEfx84vXt6ecP9GkcYBZGXXc5qje8gu0Sa2ruceO1TQRXjS/XE WMM/pENQYb0EA6lN/4gs6Z6OYq9wKmmvoVVcice58d3KHK+xG2/JekJD5Q3c8bAIVZpt DvQY9ezfXwtLuLE5ZlHODvjLhqzVmGHmukPeStagkka3OheA/F/FTTsL82AmDlKv8bNW X3oKngoLYry3nNpXn/adlT5g8H5CcxNoZrHziE49Uvi/aU4u0p6A9gVliF+KNQSWhmL5 dumw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=SUQMdlnKRthCQ62qwHJk8Au9gymYOBsjGwwtw0vjVRU=; b=m43Tmhu3+goXd+h12mvxrWTvB7flVgd2OHNPO1V3QQA+jSweE4XeYBnGnlwzq0j/KB PUGQkFoSXXaqBT7p+bdQFA4GY9MVk5T2xp1OdFnJHsMWFEFKPcXv2BM+oWXWL8ofVFDw bcFVbJXctjEIvxsAnLu9CdfGVlSpEUtaoTxoEsEJ3zmmPwiKkWInosIvqmB49CoKAy81 Q0HTu17QrWS8/tNh0obBAmS7kSwwllWwM/qNYsFrKLMJAYd9voznfI2hnQjk3IWWAKdV N8XPBvrRCalKmBYg2wvRHdnC0kfSieJ+GOG11/B4b/ltmEKoJROEQw0kn6BiQDcQT11R u2IA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DJsAb1tT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n5si16649267pgl.485.2018.12.05.06.36.05; Wed, 05 Dec 2018 06:36:20 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=DJsAb1tT; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727630AbeLEOfN (ORCPT + 99 others); Wed, 5 Dec 2018 09:35:13 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:56634 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727103AbeLEOfN (ORCPT ); Wed, 5 Dec 2018 09:35:13 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=SUQMdlnKRthCQ62qwHJk8Au9gymYOBsjGwwtw0vjVRU=; b=DJsAb1tT+GGnSKi4lr4stzTll YMfX5dARm9m9yhE99EbWBifMg0ZC5K639PtD3ZFdNP8J9/iTONHMcuTHHyTzF9gwjki30w51j+LQ0 je6Bl6Vd+BMgxzenDq4ku2e1UumyLw5pCOjXmKb3EUYOFKidEpkW4htHkdYodq+n5kLb0FDgcDzyZ yrcOmaUlu0Mae3UBRiihJQCsd9Fo3YrOuth/bR+jZweoSDgc8kCBIObBuQ54Qeyiu0TpWN5Yr0Ktf YjyB2HDAYvg3pp+NHYydCwPQi7KZ1GhpiTTpklp0AQkI/YGFSFooqN07BRXTlHt/8VfClcnzaJwuj Ihjp8NmCw==; Received: from willy by bombadil.infradead.org with local (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUYGc-0003YG-8t; Wed, 05 Dec 2018 14:35:10 +0000 Date: Wed, 5 Dec 2018 06:35:10 -0800 From: Matthew Wilcox To: David Hildenbrand Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-m68k@lists.linux-m68k.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-mediatek@lists.infradead.org, Andrew Morton , Stephen Rothwell , Pavel Tatashin , Michal Hocko , Alexander Duyck , Anthony Yznaga , Miles Chen , yi.z.zhang@linux.intel.com, Dan Williams Subject: Re: [PATCH RFC 7/7] mm: better document PG_reserved Message-ID: <20181205143510.GA17232@bombadil.infradead.org> References: <20181205122851.5891-1-david@redhat.com> <20181205122851.5891-8-david@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181205122851.5891-8-david@redhat.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 05, 2018 at 01:28:51PM +0100, David Hildenbrand wrote: > I don't see a reason why we have to document "Some of them might not even > exist". If there is a user, we should document it. E.g. for balloon > drivers we now use PG_offline to indicate that a page might currently > not be backed by memory in the hypervisor. And that is independent from > PG_reserved. I think you're confused by the meaning of "some of them might not even exist". What this means is that there might not be memory there; maybe writes to that memory will be discarded, or maybe they'll cause a machine check. Maybe reads will return ~0, or 0, or cause a machine check. We just don't know what's there, and we shouldn't try touching the memory. > +++ b/include/linux/page-flags.h > @@ -17,8 +17,22 @@ > /* > * Various page->flags bits: > * > - * PG_reserved is set for special pages, which can never be swapped out. Some > - * of them might not even exist... > + * PG_reserved is set for special pages. The "struct page" of such a page > + * should in general not be touched (e.g. set dirty) except by their owner. > + * Pages marked as PG_reserved include: > + * - Kernel image (including vDSO) and similar (e.g. BIOS, initrd) > + * - Pages allocated early during boot (bootmem, memblock) > + * - Zero pages > + * - Pages that have been associated with a zone but are not available for > + * the page allocator (e.g. excluded via online_page_callback()) > + * - Pages to exclude from the hibernation image (e.g. loaded kexec images) > + * - MMIO pages (communicate with a device, special caching strategy needed) > + * - MCA pages on ia64 (pages with memory errors) > + * - Device memory (e.g. PMEM, DAX, HMM) > + * Some architectures don't allow to ioremap pages that are not marked > + * PG_reserved (as they might be in use by somebody else who does not respect > + * the caching strategy). Consequently, PG_reserved for a page mapped into > + * user space can indicate the zero page, the vDSO, MMIO pages or device memory. So maybe just add one more option to the list.