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=-11.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham 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 063D5C433E0 for ; Thu, 28 Jan 2021 22:30:42 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 8314B64DF2 for ; Thu, 28 Jan 2021 22:30:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8314B64DF2 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 1D5816B0005; Thu, 28 Jan 2021 17:30:41 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 187596B0006; Thu, 28 Jan 2021 17:30:41 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 09FEE6B006C; Thu, 28 Jan 2021 17:30:41 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0033.hostedemail.com [216.40.44.33]) by kanga.kvack.org (Postfix) with ESMTP id E6E2D6B0005 for ; Thu, 28 Jan 2021 17:30:40 -0500 (EST) Received: from smtpin11.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id B5FAC180AD837 for ; Thu, 28 Jan 2021 22:30:40 +0000 (UTC) X-FDA: 77756629440.11.play50_3e04265275a3 Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin11.hostedemail.com (Postfix) with ESMTP id 97D11180F8B86 for ; Thu, 28 Jan 2021 22:30:40 +0000 (UTC) X-HE-Tag: play50_3e04265275a3 X-Filterd-Recvd-Size: 6709 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [63.128.21.124]) by imf07.hostedemail.com (Postfix) with ESMTP for ; Thu, 28 Jan 2021 22:30:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611873039; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bWweQZM4f7mg4qkIAMaz4ZdNmbcyBaxOSuPAnH/0aoM=; b=h7S+p4lbK6c8vu/tBfVh7T53quEL/j/PdVWmi3SwBsFmjFVSsy9aROrp1mLUW8VFZ3QIJ9 QxscWU87Q/cKP0g497x443Ia5EXFGv4fr5pLLyAjgcn1usGqPmeIsoAS9dQpc+CaHiugZw mL6uor4pKiGTL+N18N88Bk8TYsrd3lM= Received: from mail-wr1-f69.google.com (mail-wr1-f69.google.com [209.85.221.69]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-416-F8KTVJmRPmeu_LY4GVDNYw-1; Thu, 28 Jan 2021 17:30:36 -0500 X-MC-Unique: F8KTVJmRPmeu_LY4GVDNYw-1 Received: by mail-wr1-f69.google.com with SMTP id l13so3893405wrq.7 for ; Thu, 28 Jan 2021 14:30:36 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=BWdKaMuCZ+HHzjgfktT+jouFy+6VZ9GcHMswE44Yles=; b=eUkHx/6LUFH/1UAY+REtlKwXOW1BnXA8/fAzvzFd+pacjPGh25UDoIHfhlCHPXlha/ 2ZCqxlc0bBMBzM/4OvdVSVl3cIMwLgtI1n0Y6uIWyK0A3e6PFB+mglkQhrPw1JLFOAwc YnXJbmR3Euk8XzbHpT6F4BlUl9b553G0fkrDxEIip8uFJmSzAfugEDZJ6TA5yHMNa7op e3NmPaj+jhZAR84kwL1952rq6IB8H4lvPCW7edP8PcdGi8lpF2u1ADtuD6JhUVZjkMba BtnPa7bkTdHY5jxqv69vhJO0cyRtVidfslmdljMkm0hOKlBYZ+81sZjPGKOa8Ai5dINU vvCw== X-Gm-Message-State: AOAM532JnP+idFwpg4XEjWCaMIYAmDlzLM0kZtK9dom/f/F+j1Et87je GI7mhtiNvI8H/I+PDEiz6mMp6rdfj6S+Jc741fpTxTFAShUGPd4Z7Up6WLvbCK05oONL8zfsvlG 3zsMIDWw8MLk= X-Received: by 2002:a5d:4b0b:: with SMTP id v11mr1283874wrq.226.1611873035355; Thu, 28 Jan 2021 14:30:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJxn3h5kinNtCU52JfJLJu32fgDwMUJMEY0AZ7dz8O2wBaHcZtwyYlApVZxRXD7DfG+kujRu9A== X-Received: by 2002:a5d:4b0b:: with SMTP id v11mr1283854wrq.226.1611873035174; Thu, 28 Jan 2021 14:30:35 -0800 (PST) Received: from [192.168.3.108] (p5b0c66c6.dip0.t-ipconnect.de. [91.12.102.198]) by smtp.gmail.com with ESMTPSA id y18sm8653691wrt.19.2021.01.28.14.30.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jan 2021 14:30:34 -0800 (PST) From: David Hildenbrand Mime-Version: 1.0 (1.0) Subject: Re: [PATCH v2] mm/page_alloc: count CMA pages per zone and print them in /proc/zoneinfo Date: Thu, 28 Jan 2021 23:30:33 +0100 Message-Id: <2CF5220A-5452-4913-AFCB-41E1C642E521@redhat.com> References: <89e1dbcd-605d-6a7b-361-c130f7eb9d8c@google.com> Cc: David Hildenbrand , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Thomas Gleixner , "Peter Zijlstra (Intel)" , Mike Rapoport , Oscar Salvador , Michal Hocko , Wei Yang , linux-api@vger.kernel.org In-Reply-To: <89e1dbcd-605d-6a7b-361-c130f7eb9d8c@google.com> To: David Rientjes X-Mailer: iPhone Mail (18C66) Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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: > Am 28.01.2021 um 23:28 schrieb David Rientjes : >=20 > =EF=BB=BFOn Thu, 28 Jan 2021, David Hildenbrand wrote: >=20 >>> =EF=BB=BFOn Thu, 28 Jan 2021, David Hildenbrand wrote: >>>=20 >>>> diff --git a/mm/vmstat.c b/mm/vmstat.c >>>> index 7758486097f9..957680db41fa 100644 >>>> --- a/mm/vmstat.c >>>> +++ b/mm/vmstat.c >>>> @@ -1650,6 +1650,11 @@ static void zoneinfo_show_print(struct seq_file= *m, pg_data_t *pgdat, >>>> zone->spanned_pages, >>>> zone->present_pages, >>>> zone_managed_pages(zone)); >>>> +#ifdef CONFIG_CMA >>>> + seq_printf(m, >>>> + "\n cma %lu", >>>> + zone->cma_pages); >>>> +#endif >>>>=20 >>>> seq_printf(m, >>>> "\n protection: (%ld", >>>=20 >>> Hmm, not sure about this. If cma is only printed for CONFIG_CMA, we ca= n't=20 >>> distinguish between (1) a kernel without your patch without including s= ome=20 >>> version checking and (2) a kernel without CONFIG_CMA enabled. IOW,=20 >>> "cma 0" carries value: we know immediately that we do not have any CMA= =20 >>> pages on this zone, period. >>>=20 >>> /proc/zoneinfo is also not known for its conciseness so I think printin= g=20 >>> "cma 0" even for !CONFIG_CMA is helpful :) >>>=20 >>> I think this #ifdef should be removed and it should call into a=20 >>> zone_cma_pages(struct zone *zone) which returns 0UL if disabled. >>>=20 >>=20 >> Yeah, that=E2=80=99s also what I proposed in a sub-thread here. >>=20 >=20 > Ah, I certainly think your original intuition was correct. >=20 >> The last option would be going the full mile and not printing nr_free_cm= a. Code might get a bit uglier though, but we could also remove that stats = counter ;) >>=20 >> I don=E2=80=98t particularly care, while printing =E2=80=9E0=E2=80=9C mi= ght be easier, removing nr_free_cma might be cleaner. >>=20 >> But then, maybe there are tools that expect that value to be around on a= ny kernel? >>=20 >=20 > Yeah, that's probably undue risk, the ship has sailed and there's no=20 > significant upside. >=20 > I still think "cma 0" in /proc/zoneinfo carries value, though, especially= =20 > for NUMA and it looks like this is how it's done in linux-next. With a= =20 > single read of the file, userspace can make the determination what CMA=20 > pages exist on this node. >=20 > In general, I think the rule-of-thumb is that the fewer ifdefs in=20 > /proc/zoneinfo, the easier it is for userspace to parse it. Makes sense, I=E2=80=98ll send an updated version tomorrow - thanks! >=20 > (I made that change to /proc/zoneinfo to even print non-existant zones fo= r=20 > each node because otherwise you cannot determine what the indices of=20 > things like vm.lowmem_reserve_ratio represent.)