From patchwork Wed Dec 5 12:28:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Hildenbrand X-Patchwork-Id: 10714021 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 5391D1731 for ; Wed, 5 Dec 2018 12:30:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 444B62CC55 for ; Wed, 5 Dec 2018 12:30:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 37B112CE95; Wed, 5 Dec 2018 12:30:25 +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=ham 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 5C5FF2CC55 for ; Wed, 5 Dec 2018 12:30:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 644E26B744D; Wed, 5 Dec 2018 07:30:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 6184F6B7456; Wed, 5 Dec 2018 07:30:22 -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 507F16B7457; Wed, 5 Dec 2018 07:30:22 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by kanga.kvack.org (Postfix) with ESMTP id 218B86B744D for ; Wed, 5 Dec 2018 07:30:22 -0500 (EST) Received: by mail-qk1-f197.google.com with SMTP id n68so19567063qkn.8 for ; Wed, 05 Dec 2018 04:30:22 -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:in-reply-to:references; bh=SR+GJnGNFZkXpFDzTNvr0cck4cT7IZAArtvDfgMQylU=; b=l4RswuTDa4n3L+dyd+fIiEBD8nJpSRONSBC+gyMSi/IqP91+148vhD/MMi/VuT7/kd 1ldm7gmR2cxIE4czcjgolsEU16Z3hmU/x7e3DxsxoyMW0s7iv7KWqfi3k+Htj+NF/++2 u14jOcmAgQoy3qV3kRFjXbbknISURPk8B58Bt4z1h2MNlQWi3+tDslBNa4x/000Dz2kj 9K2IZA0K+hkxoVO7OGvTlq6mcsdBAWrxPfk7TDnC7gypG4nfs1DAdXgQuYTkQatV3D0k eHCdQSoBhLHJfodzg0zipQfzMOiNsT4huOS19cpSXd5WfPND3GFzt4kGl1ciSwpVB1Bs O1QA== 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: AA+aEWbdIQuZyBEOk3elGLP+YTh6+sAPcoels3h9XT89eG5JmI+ACoQq MTkp21JjQp7y6pQDYmXD+lRn8sNh3b7pq5PMO3WmnchsglX8tH4VAdTz84UhXgGb8J+e73N4ir0 kFTU+ouk+44sdUnOJmw6a4qhH02v2KFIyWURYBCKyuUnNU+YP/HT0z3p+1/CHPtsNIA== X-Received: by 2002:aed:2044:: with SMTP id 62mr23113806qta.11.1544013021873; Wed, 05 Dec 2018 04:30:21 -0800 (PST) X-Google-Smtp-Source: AFSGD/V79OBzwm9Q0+1cskKfpXloTJm10LwiuNkROyZzC2VzDMk8BPnUZE9b2XbvtSjGFxu1B7Gy X-Received: by 2002:aed:2044:: with SMTP id 62mr23113751qta.11.1544013020949; Wed, 05 Dec 2018 04:30:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544013020; cv=none; d=google.com; s=arc-20160816; b=JUeXNOO3Qx57A3s9zseSvhJ+ilp0ISR8XcqR6qHkgf7s3cr3jR/Uxx4DVmkvD07MOx SXaSQ4wWVEUsxSWdxA6TpgXbB1SvUwb59Idd8XIp/rF3KD72qA/GHbj4Zu9p9FCFpoCF mX8/f7csvQx5twC1Hm0Qc4fcNb849DKhiVX+wkePcMRQJEQ9XLw4f7OfXKUbmeUnxMAU yuL43bP56HLsDjyfeFTuiU+WlIlZELjYLrbhChiw+CKQ9OqR60yomJCAoVjUR0Ba/Tx2 vxawdtwAM/PDs6a9yDfyxHseWgZeGf4GUV+sEg2ylPXrhjWgQi/O/Ux7pPhS9E8z6/OE tlyA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=SR+GJnGNFZkXpFDzTNvr0cck4cT7IZAArtvDfgMQylU=; b=CJarmFpuPjrb95Qs0Ul/PI10CAA03Z5fktRyx9b6o5hkan2Ykk4s82NRb6IWSow+1I m+QAYgVUKN4e82yJEqX4vYJau6EGM957Rl7cLOSo+sD40v+Y+dhTVN8rdVbflqfJ7dij ilBDqCz8lYZJFD3WubHqVTkGHPVAGPh24P/tVuIcjzDUZZb3qT3Ul5xcmpkyyN/EToUF mKWZ8bi41xvciS/cgiyZ9P75RZjvtdP5ywuQWWffbxERCo2sUrxoz+AT2L4FZJVeFloX WDOybkI1fFABpE4xkKJivk/Y8BITf21YLhaKqnP4o4SjfmT6r6MOyyxfVnsrtnj2W4si N4lg== 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 g34si404232qte.104.2018.12.05.04.30.20 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 05 Dec 2018 04:30:20 -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-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id B69453078A25; Wed, 5 Dec 2018 12:30:19 +0000 (UTC) Received: from t460s.redhat.com (ovpn-117-65.ams2.redhat.com [10.36.117.65]) by smtp.corp.redhat.com (Postfix) with ESMTP id 3C16E183D2; Wed, 5 Dec 2018 12:30:16 +0000 (UTC) From: David Hildenbrand To: linux-mm@kvack.org Cc: 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, David Hildenbrand , Andrew Morton , Stephen Rothwell , Pavel Tatashin , Michal Hocko , Alexander Duyck , Matthew Wilcox , Anthony Yznaga , Miles Chen , yi.z.zhang@linux.intel.com, Dan Williams Subject: [PATCH RFC 7/7] mm: better document PG_reserved Date: Wed, 5 Dec 2018 13:28:51 +0100 Message-Id: <20181205122851.5891-8-david@redhat.com> In-Reply-To: <20181205122851.5891-1-david@redhat.com> References: <20181205122851.5891-1-david@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.43]); Wed, 05 Dec 2018 12:30:20 +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 The usage of PG_reserved and how PG_reserved pages are to be treated is burried deep down in different parts of the kernel. Let's shine some light onto these details by documenting (most?) current users and expected behavior. 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. Cc: Andrew Morton Cc: Stephen Rothwell Cc: Pavel Tatashin Cc: Michal Hocko Cc: Alexander Duyck Cc: Matthew Wilcox Cc: Anthony Yznaga Cc: Miles Chen Cc: yi.z.zhang@linux.intel.com Cc: Dan Williams Signed-off-by: David Hildenbrand --- include/linux/page-flags.h | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 68b8495e2fbc..112526f5ba61 100644 --- a/include/linux/page-flags.h +++ 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. * * The PG_private bitflag is set on pagecache pages if they contain filesystem * specific data (which is normally at page->private). It can be used by