Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9441052imu; Wed, 5 Dec 2018 05:00:53 -0800 (PST) X-Google-Smtp-Source: AFSGD/XSp3/yX2qSE9stiDkxiK2Fuq+Nt5CiC67wRKg+iOXq6R1FRkQAmOTfbYV5HlLa39s56f+7 X-Received: by 2002:a17:902:7588:: with SMTP id j8mr4877113pll.215.1544014853472; Wed, 05 Dec 2018 05:00:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544014853; cv=none; d=google.com; s=arc-20160816; b=eL8fc3Ui6hd88gMVGQ0c/hfHSpFQdFWYAiXlM+jpXcMwO4SMmu4N1ja3o+c+hz+uOR M7QR+2KiOPWukovG/hDVvk/FyGB/9tTLFul7lxJwnr1ErrazWiGaC6yJLqDJzt9/9E+3 3N2mirlLj68yItcK/PTABvV4JQzwFtAs2zectxvuBGBf15V7bxt70fu54pU/pf778dIw bPc2BFBQJ024O4IQMcIeAnqY8ECoKzDNuya+UxYAszX1Ke8lcJdRs1yZ/nY4kHpIL11C 6SNqxnQq2Lgbn8aY9Kf9qDcD+SuDEplAZ1LKjogydZwDXXf5Y8zbSSvyaUkxxgbFoUNK fZmg== 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; bh=Pk+eTAMahYwvWm4C0OaLW7tAynJu7scjEHQDXp+G0qo=; b=BTjDHh4zs6NbJVGfL5dr1j6mTzxIkiwJnJERD0egydWR8A2Cf+MVgxSi7fe0TGqyC1 TS45e2dhb8PG26CEe/GrEc+MVQJgEaXhMVGtMaKxHZVyTfmjevBnLIIooZzPcq8nOw2L 5PHwqD4QHbrkM2z4xvUBE7kilyB1LB0rVdwSVHZO1DGqzvsBcQiOqvrBuwXGwQh9IgJC kZxC35tvvVpPg8LF97q+vGEhb16t9FWVyY7Cjc+ifbnbchGWLm896MDTVkUBQ2DcWICQ KPYrYO+tvgUV9oKsvWI+VuRIdX8HsVQKCoORRKLjFwxKxDGCoKs2LoYw/ZTwFDzFF+0G QGug== 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=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y123si20175497pfy.18.2018.12.05.05.00.38; Wed, 05 Dec 2018 05:00:53 -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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727895AbeLENAB (ORCPT + 99 others); Wed, 5 Dec 2018 08:00:01 -0500 Received: from mx2.suse.de ([195.135.220.15]:56054 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726944AbeLENAB (ORCPT ); Wed, 5 Dec 2018 08:00:01 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7CA82B0E5; Wed, 5 Dec 2018 12:59:58 +0000 (UTC) Date: Wed, 5 Dec 2018 13:59:58 +0100 From: Michal Hocko 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 , Alexander Duyck , Matthew Wilcox , 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: <20181205125957.GN1286@dhcp22.suse.cz> 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.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 05-12-18 13:28:51, David Hildenbrand wrote: > 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 This looks like an improvement. The essential part is that PG_reserved page belongs to its user and no generic code should touch it. The rest is a description of current users which I haven't checked due to to lack of time but yeah, I like the updated wording because I have seen multiple people confused from the swapped out part which is not true for many many years. I have tried to dig out when it was actually the case but failed. So I cannot give my Ack because I didn't really do a real review but I like this FWIW. > --- > 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 > -- Michal Hocko SUSE Labs