From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8241BC04EBF for ; Wed, 5 Dec 2018 13:00:34 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 456A02081B for ; Wed, 5 Dec 2018 13:00:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="nfZJeo4l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 456A02081B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XtRy5ImMYwFaTyhgYjeXby1VXmxeJ6VORNFw5M/XTOI=; b=nfZJeo4lY0BZiV q6yOuHPazZOYxLucsScrGzya255+KaBcFLLoFtg5NwY1aVYVRKZbBNkRrNhND1Zg/iG/Bk23241dD 2s4QKdhw8Ow0GQZXt1c1OZZ3n0VbdzJ6mnFrk7U8V80NWd2mbxoJ4sCtX/gdAWSc5u6im+Gnc1eR3 gY1v5dNi8Lb0S/LfiAYHEU+EyqA16vahD1w4rfKsy1UXerVvJTRmPx2b4sz4jzzrtNlSWg78lHiHy GvyMRNw7/BH+U7osrojJ9qKjvelf1PVztNPjuvl2WHcOAp5/XfOE1eweSdMK9rTdR1nCIx5pJypr+ uK/MctCzhLoVI3IkyeKw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUWn1-0002D0-Tf; Wed, 05 Dec 2018 13:00:31 +0000 Received: from mx2.suse.de ([195.135.220.15] helo=mx1.suse.de) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1gUWmg-0000WH-09; Wed, 05 Dec 2018 13:00:18 +0000 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 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-Disposition: inline In-Reply-To: <20181205122851.5891-8-david@redhat.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20181205_050010_458662_DBC081F6 X-CRM114-Status: GOOD ( 22.59 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-s390@vger.kernel.org, yi.z.zhang@linux.intel.com, Stephen Rothwell , Alexander Duyck , Dan Williams , linux-kernel@vger.kernel.org, Matthew Wilcox , Pavel Tatashin , linux-mm@kvack.org, linux-m68k@lists.linux-m68k.org, linux-mediatek@lists.infradead.org, Miles Chen , Anthony Yznaga , linux-riscv@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, Andrew Morton , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv