Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1358207pxb; Thu, 28 Jan 2021 14:33:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJzFGD836nQeiUYnseYL9pU9ATukMQmY9sM+Q6XORiQ4M8Yik3bwzo1qFtnB2iush+V4wLLj X-Received: by 2002:a17:906:eb1b:: with SMTP id mb27mr1730590ejb.332.1611873192028; Thu, 28 Jan 2021 14:33:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611873192; cv=none; d=google.com; s=arc-20160816; b=Ks5qIWaOnDnTOUqBq4zXvfXVeG+OFguv5z4ASZPZcY+RJnr/QFeH8R3gPjX/h0nS8S Scbe6pyJ8HFHnP8Fl2T267ORJARjfKgM1t71xmVHymfQRqBmhpWXky0qv//zdIIYXiSi vcCYtOrKh7S1Gdj7YihXXPfzv9zuTrCHJ+qRBppb8soUaiNIzKfXTkNnuq880+rDibfh QCiCqbV3xqcr9Q3aHFE2/l9vgCZT90vhDTdb6OkStKNkTkzTb8YteZTqpoj8iFp2fK0C 4esDEGD1Nu3YzpiMLeNmQFMhQlnZ7E2DaainenG1b4oAjra/OJYyEuS2ZVYx11J6ars6 qQFQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:to:in-reply-to:cc:references:message-id:date :subject:mime-version:from:content-transfer-encoding:dkim-signature; bh=BWdKaMuCZ+HHzjgfktT+jouFy+6VZ9GcHMswE44Yles=; b=B0tGj07jR7MGXukCu8z5/o3gCbOoq4oZAutdWSq/JT7Ev207KdB6yikZPZVaWWYj9M A2SMErH9UcrKPImIoARBCA2FPjMWPlLp8Gd1SUY6/5fgkH2qiLPObku6fAHeP4aAIdgz dkN0PUkmeO79+FdKR50wqV1tbsimiw/fpgWFwR9Xt3DoWi15rowpx37CALaFD99wrDPP S6/gBC5VyAptMrUb779jMlsMIeF7NUQiId2ukPPUxC0ZwuCMdnICDzAcqUQZAkMaCfFB koLjJ4/rCw+az1nCKJHjNi1auzYvZVntFVxTair7SCLM/WvPdakdYAUX3IyEZeAZObYf Bc/w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GcK7HA8G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h4si3744050edv.124.2021.01.28.14.32.47; Thu, 28 Jan 2021 14:33:12 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=GcK7HA8G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231171AbhA1WcP (ORCPT + 99 others); Thu, 28 Jan 2021 17:32:15 -0500 Received: from us-smtp-delivery-124.mimecast.com ([63.128.21.124]:38110 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229561AbhA1WcH (ORCPT ); Thu, 28 Jan 2021 17:32:07 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1611873040; 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=BWdKaMuCZ+HHzjgfktT+jouFy+6VZ9GcHMswE44Yles=; b=GcK7HA8G8YoKFt3jnY8AymagcawFwQks6ljOBXFZp4/smQd5uhQ8hRHONpGtK0P8It0AXT LVLlYErwQGnPX30uYFjYM7eMniZV89irwDbZv/muu7WjlQluqs0Rfhup3fcQ5+/QaLTHiL eBWhd7UH0sN3oABQnsIadrPVQvEsHI8= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-396-ymhRbMjpMfiFgQ-kfgcD3w-1; Thu, 28 Jan 2021 17:30:37 -0500 X-MC-Unique: ymhRbMjpMfiFgQ-kfgcD3w-1 Received: by mail-wm1-f72.google.com with SMTP id 5so2636308wmq.0 for ; Thu, 28 Jan 2021 14:30:37 -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=qBBUEik3UPjoqT/5pyYErlH/x+JQeZ1BSLoN5h5SQx+LgU3k4CP4wIx/VLff43kmsG T5/VFTnjvodKLA9C/8YDzGyHCTuc+CY+QXFyixGieR+TVUQyi8r+5pjCBUFD/Vii6NQl s1Xs9LOOlzSid5GOZbFR5QZR10ge87ADgFh3uJMSyjDHdpIlEWbjffJX60FI0NJEW1UG bD1IrPzHTyJ3XDtq9lf+3Yh2Cy1G+3eYCrkEMweC8VeoeHN+oNhgvuud1SJkfpGBVouC pjTu83AShEevZ+9NyYJ5kd3yY7itjNMOHK2jslCMOFF42d05cHM7Rge4FRXpIopIV8me oaQQ== X-Gm-Message-State: AOAM531saO5ZJUODF83JV4uGsdB9ipWga6TS2Je4PHQrW1vp+FwIFrjm QGuky0cEdKdJNdlQq8l0C7y5f8gRzQ68aY8Mfo7rw8J3gLKpxCGC9M2hox/I+0joHv+MZeKLWV8 PBNun2Y7hYDAvgdOScXTIfrMN X-Received: by 2002:a5d:4b0b:: with SMTP id v11mr1283867wrq.226.1611873035355; Thu, 28 Jan 2021 14:30:35 -0800 (PST) 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) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > 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 can= 't=20 >>> distinguish between (1) a kernel without your patch without including so= me=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 printing= =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_cma= . Code might get a bit uglier though, but we could also remove that stats co= unter ;) >>=20 >> I don=E2=80=98t particularly care, while printing =E2=80=9E0=E2=80=9C mig= ht be easier, removing nr_free_cma might be cleaner. >>=20 >> But then, maybe there are tools that expect that value to be around on an= y 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 for= =20 > each node because otherwise you cannot determine what the indices of=20 > things like vm.lowmem_reserve_ratio represent.)