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 E4253C433DF for ; Tue, 11 Aug 2020 02:37:23 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 82BE520639 for ; Tue, 11 Aug 2020 02:37:23 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="SGstpB6I" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 82BE520639 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 D69506B0003; Mon, 10 Aug 2020 22:37:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D18116B0005; Mon, 10 Aug 2020 22:37:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C06C96B0006; Mon, 10 Aug 2020 22:37:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0032.hostedemail.com [216.40.44.32]) by kanga.kvack.org (Postfix) with ESMTP id AAE726B0003 for ; Mon, 10 Aug 2020 22:37:22 -0400 (EDT) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 2F6C32484 for ; Tue, 11 Aug 2020 02:37:22 +0000 (UTC) X-FDA: 77136726324.11.frog23_3e0279426fdf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id F3DA9180F8B81 for ; Tue, 11 Aug 2020 02:37:21 +0000 (UTC) X-HE-Tag: frog23_3e0279426fdf X-Filterd-Recvd-Size: 4899 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [207.211.31.120]) by imf03.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Aug 2020 02:37:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1597113440; 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=wLzl3wtWD+w+9nf2IFob9HHSS64PNVwry8gfZW52AKU=; b=SGstpB6INM3O96KjG3IGiEcizjHpDLfidfYyRJKeCWZbHwdCNsjhgtEj+exGR+eJKd1T6C CiRiFvEuI7wqzjnrDCspRBNnltNSNlHa8thXmG27svpx62erBYyI7fteLElckBfEeIuFn7 4OMfiSgIdIELvqLJovxYkJqx/xIxOa4= 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-191-RF3OXuMPPvew1J0u7IHZKA-1; Mon, 10 Aug 2020 22:37:17 -0400 X-MC-Unique: RF3OXuMPPvew1J0u7IHZKA-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id BE5CB1DE1; Tue, 11 Aug 2020 02:37:15 +0000 (UTC) Received: from localhost (ovpn-13-96.pek2.redhat.com [10.72.13.96]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 2DC286F12F; Tue, 11 Aug 2020 02:37:14 +0000 (UTC) Date: Tue, 11 Aug 2020 10:37:12 +0800 From: Baoquan He To: Yu Zhao Cc: Sonny Rao , linux-mm@kvack.org, David Rientjes , Andrew Morton Subject: Re: ABI compatibility for /proc/zoneinfo Message-ID: <20200811023712.GB10792@MiWiFi-R3L-srv> References: <20200810214614.GA1679980@google.com> MIME-Version: 1.0 In-Reply-To: <20200810214614.GA1679980@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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: F3DA9180F8B81 X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam04 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 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. (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) >