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=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no 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 90992C433DF for ; Tue, 11 Aug 2020 03:58:18 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 28230206EF for ; Tue, 11 Aug 2020 03:58:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="PLrC/KE8" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 28230206EF Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id BC4F56B0003; Mon, 10 Aug 2020 23:58:17 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B748B6B0005; Mon, 10 Aug 2020 23:58:17 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A3C476B0006; Mon, 10 Aug 2020 23:58:17 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0112.hostedemail.com [216.40.44.112]) by kanga.kvack.org (Postfix) with ESMTP id 8A0AF6B0003 for ; Mon, 10 Aug 2020 23:58:17 -0400 (EDT) Received: from smtpin04.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay03.hostedemail.com (Postfix) with ESMTP id 4C0C48248047 for ; Tue, 11 Aug 2020 03:58:17 +0000 (UTC) X-FDA: 77136930234.04.sign97_120818426fdf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin04.hostedemail.com (Postfix) with ESMTP id 1D144800CBC6 for ; Tue, 11 Aug 2020 03:58:17 +0000 (UTC) X-HE-Tag: sign97_120818426fdf X-Filterd-Recvd-Size: 6071 Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) by imf36.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Aug 2020 03:58:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597118295; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=7dz92jP2ghDIXSJs5TosiNqOJuOunPC+neakl8xryzk=; b=PLrC/KE8uj3F8fjjnjyTDA27mi8b/IjrNjrlVSEw80EdpTLgVdtg/hGEzeMMJHoEN3KB8w 6j6TwjYAKinGPSXdNDaKSzdgXMqi5HJDuwPi0WcTtXRrfvos4Ek5F6I0RkiOjN8RUzZSnZ 7KzrHBjBa5KpC0nqXDSqPz32zeWhWrI= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-422-NCJmlsZzMt-3VR9NVue2Dw-1; Mon, 10 Aug 2020 23:58:11 -0400 X-MC-Unique: NCJmlsZzMt-3VR9NVue2Dw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9CD398017FB; Tue, 11 Aug 2020 03:58:09 +0000 (UTC) Received: from localhost (ovpn-13-96.pek2.redhat.com [10.72.13.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C58875D9E4; Tue, 11 Aug 2020 03:58:08 +0000 (UTC) Date: Tue, 11 Aug 2020 11:58:06 +0800 From: Baoquan He To: Sonny Rao Cc: Yu Zhao , linux-mm@kvack.org, David Rientjes , Andrew Morton Subject: Re: ABI compatibility for /proc/zoneinfo Message-ID: <20200811035806.GX14854@MiWiFi-R3L-srv> References: <20200810214614.GA1679980@google.com> <20200811023712.GB10792@MiWiFi-R3L-srv> MIME-Version: 1.0 In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=bhe@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Rspamd-Queue-Id: 1D144800CBC6 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam01 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: On 08/10/20 at 08:18pm, Sonny Rao wrote: > On Mon, Aug 10, 2020 at 7:37 PM Baoquan He wrote: > > > > On 08/10/20 at 03:46pm, Yu Zhao wrote: > > > On Mon, Aug 10, 2020 at 02:24:03PM -0700, Sonny Rao wrote: > > > > We (Chrome OS) noticed recently one of our tests started failing on > > > > upstream kernels while parsing /proc/zoneinfo > > > > I think this patch is the cause: > > > > > > > > 26e7deadaae17 mm/vmstat.c: do not show lowmem reserve protection > > > > information of empty zone > > > > > > > > Maybe our parser was being overly strict by looking for the protection > > > > line, and it's not hard to fix but raised the question of whether there's > > > > any ABI compatibility guarantees about these files? > > > > > > According to Documentation/admin-guide/sysctl/vm.rst, "Each zone has > > > an array of protection pages". I'm not sure if this is the guarantee, > > > but the doc should reflect the actual format. > > > > The current code will list all zones in one memory node, even though > > that node only has one existing zone. E.g in below node 1, > > it only has NORMAL zone, but we will list zone DMA, DMA32, MOVABLE, > > DEVICE which are all empty zone, namely doesn't exist. So, each zone > > has an array of protection pages, it should not include the nonexistent > > zone. I thought nobody would check the protection line of an empty zone, > > seems I was wrong. > > > This particular parser was written as a state machine and that line > was a convenient thing to look for to mark the end of each zone. > AFAICT, there's no explicit documentation on the layout of that file > though. Ah, I see. While the protection line can only mark the end of empty zone. For populated zone, it obvisouly can't. One wild idea is not showing those empty zones at all. On NUMA system with multiple memory nodes, the nodes other than node0 won't have DMA, DMA32 zone usually, it doesn't make any sense to list them in /proc/zoneinfo. > > > > > > > (Note that below /proc/zoneinfo is from an old system, protection line > > is still existing for empty zone) > > Node 1, zone DMA > > pages free 0 > > min 0 > > low 0 > > high 0 > > spanned 0 > > present 0 > > managed 0 > > protection: (0, 0, 61854, 61854, 61854) > > Node 1, zone DMA32 > > pages free 0 > > min 0 > > low 0 > > high 0 > > spanned 0 > > present 0 > > managed 0 > > protection: (0, 0, 61854, 61854, 61854) > > Node 1, zone Normal > > per-node stats > > nr_inactive_anon 259 > > nr_active_anon 11926 > > ... > > nr_written 0 > > nr_kernel_misc_reclaimable 0 > > pages free 16206452 > > pages free 16206452 > > min 11280 > > low 27114 > > high 42948 > > spanned 16777216 > > present 16777216 > > managed 15834637 > > protection: (0, 0, 0, 0, 0) > > ... > > > > Node 1, zone Movable > > pages free 0 > > min 0 > > low 0 > > high 0 > > spanned 0 > > present 0 > > managed 0 > > protection: (0, 0, 0, 0, 0) > > Node 1, zone Device > > pages free 0 > > min 0 > > low 0 > > high 0 > > spanned 0 > > present 0 > > managed 0 > > protection: (0, 0, 0, 0, 0) > > > > > >