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=-4.1 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 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 E0FE9C433E0 for ; Tue, 11 Aug 2020 03:18:25 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 9964420768 for ; Tue, 11 Aug 2020 03:18:25 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=chromium.org header.i=@chromium.org header.b="JJ3ZCfiR" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9964420768 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 124E26B0003; Mon, 10 Aug 2020 23:18:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0ACE76B0005; Mon, 10 Aug 2020 23:18:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB6A86B0006; Mon, 10 Aug 2020 23:18:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0059.hostedemail.com [216.40.44.59]) by kanga.kvack.org (Postfix) with ESMTP id D267F6B0003 for ; Mon, 10 Aug 2020 23:18:24 -0400 (EDT) Received: from smtpin18.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 9BD7B180AD811 for ; Tue, 11 Aug 2020 03:18:24 +0000 (UTC) X-FDA: 77136829728.18.alarm59_0006d0a26fdf Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin18.hostedemail.com (Postfix) with ESMTP id 6DD32100EC67C for ; Tue, 11 Aug 2020 03:18:24 +0000 (UTC) X-HE-Tag: alarm59_0006d0a26fdf X-Filterd-Recvd-Size: 5519 Received: from mail-io1-f50.google.com (mail-io1-f50.google.com [209.85.166.50]) by imf50.hostedemail.com (Postfix) with ESMTP for ; Tue, 11 Aug 2020 03:18:23 +0000 (UTC) Received: by mail-io1-f50.google.com with SMTP id s189so11213070iod.2 for ; Mon, 10 Aug 2020 20:18:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Nmad42X5oHQ0l7Y8jVLbIAuYsCrG5Pjy/Py9/ovx/u0=; b=JJ3ZCfiRevooc7+aXazGESDWJKaGQAtMoBmEjc7U0O7LOCuEiYES8qoBU1Fyl1F4vp pLBz4TIeWN+KXvKT+DEMR5Ci8p9UTQ4GJt5Ks/RCMqpjkmHWRUsIlzwoXQE+d/AVea+D vQ0q8FrqG3SZJIhHQEBzcnYKQTjGs3sQseN3E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Nmad42X5oHQ0l7Y8jVLbIAuYsCrG5Pjy/Py9/ovx/u0=; b=p24bHEeVVhpMiSgwfbxc9iKZbBbOZJgwgfolU76lnXQFWz9+hGVyuJkwbMQfYLKVDz F1Eo0+lFUN1dQ3zCd6rY84TNwjey7BlzEkuNgy207HWIxDYw2sFKognNWQvGJ0t8Kixw AHCifzZ0ZcJzEEzbrOguyPu5TLNBLORq1scaD13eEM4tZh1X/B77evD7FTFLagwXKJji IDrZQJSvcJqJLi4FnKtmuLRX4pdbiwcYxwBpVtgQOrIev2kqXgx1Zx2exjIBcRm0A7UH bTSDiuYYwZD1LBezKpZBx5eV7z10z2WswFZTF+xzxpDexwb8sbqhhhkodyR4wMI7Uiwl mIhg== X-Gm-Message-State: AOAM53318HICykPGUeiBFZ/WWF0h/c16QMFn7Ydt2t+r8mH238ederck X491sdKnKZ93MYddiB63WLh8NKK8unc2nmh3t6LNeQ== X-Google-Smtp-Source: ABdhPJzXFCZUzKwYLaw7iZ7HczdTHNsbmGOpnsRDVOYv4aJrjCjDmqRFbGje5eS352lnXl2ceKS94FYkLoO01CMTDxs= X-Received: by 2002:a6b:ba06:: with SMTP id k6mr20908439iof.101.1597115902926; Mon, 10 Aug 2020 20:18:22 -0700 (PDT) MIME-Version: 1.0 References: <20200810214614.GA1679980@google.com> <20200811023712.GB10792@MiWiFi-R3L-srv> In-Reply-To: <20200811023712.GB10792@MiWiFi-R3L-srv> From: Sonny Rao Date: Mon, 10 Aug 2020 20:18:11 -0700 Message-ID: Subject: Re: ABI compatibility for /proc/zoneinfo To: Baoquan He Cc: Yu Zhao , linux-mm@kvack.org, David Rientjes , Andrew Morton Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 6DD32100EC67C X-Spamd-Result: default: False [0.00 / 100.00] X-Rspamd-Server: rspam05 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 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. > > > (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) > > >