Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9412074imu; Wed, 5 Dec 2018 04:31:28 -0800 (PST) X-Google-Smtp-Source: AFSGD/Up7ei/NvGV9HR1kYS7gjM+TvooGncqoiG1LcvuiVASLHEbC/ne7pytsz1x2hvecRsXdzey X-Received: by 2002:aa7:8203:: with SMTP id k3mr23637636pfi.192.1544013088080; Wed, 05 Dec 2018 04:31:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544013088; cv=none; d=google.com; s=arc-20160816; b=xzIuZFUm0L/bUkbeREpxE3vmp4rbBfItRpzSniXpDZSxyTDGXfmzRxxOHWvFFIamZy 7wr3oLam59Voil6ncfGwy5CH8UXlAOeU2VSHt/9fFHgnCvICXMwdr42wL/X6qkNIgKj0 nGjakEYEm7OsQwt44W5Qg03A3DxCXuAS5jhY9VWXu05URDNn/s71TUTHOrgzg8/sdRMo 0ewy0bFrMSPs/1ukk3h/7gTGabv1NGk9GlIXv+7V0d1eb7NugivOMSZS/rawJRlwrXR0 zfuNYBYQ+vKF+FzQX8Sq5wPBQawAH2lvZAloa1WPmRrby7CxZAwgXVW8kGTIAujsWlTw fUfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=SR+GJnGNFZkXpFDzTNvr0cck4cT7IZAArtvDfgMQylU=; b=yFcenEU/7fCE2XO0wpUffS7a5rv4SUF6mpl7jKkCRTzc1ByU559venfeKLfcV/upoZ +yvEIMmEvTw6bay9GgqbR7k5svanyO625i8JbeDjNw3jMl0EcN+3oj+u6cwyizLpFLO7 UxweVeqSJ4U0HtlDpEYvx79LHBNm0eIXjo5gfMehRJX6caQS5/lp8qDWFXn1J2C1whDG Cnm0ZyKy2ycIT+zh2VZh1+Sg2vJKCZQFMwLcasPzZN5tTpjQqlC2qXotJsP9bEKZs0EU yeIezC29dxGzg6F1WC9bgwZZ0DR/zDKZjc9Aafj4bDfaYFiILLyHv0Z9YWAp4Vt47uG6 nS1g== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f1si18487234pgn.502.2018.12.05.04.31.12; Wed, 05 Dec 2018 04:31:28 -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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727973AbeLEMaW (ORCPT + 99 others); Wed, 5 Dec 2018 07:30:22 -0500 Received: from mx1.redhat.com ([209.132.183.28]:43378 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727838AbeLEMaU (ORCPT ); Wed, 5 Dec 2018 07:30:20 -0500 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) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.17.2