linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Hildenbrand <david@redhat.com>
To: David Rientjes <rientjes@google.com>
Cc: David Hildenbrand <david@redhat.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	"Peter Zijlstra (Intel)" <peterz@infradead.org>,
	Mike Rapoport <rppt@kernel.org>,
	Oscar Salvador <osalvador@suse.de>,
	Michal Hocko <mhocko@kernel.org>,
	Wei Yang <richard.weiyang@linux.alibaba.com>,
	linux-api@vger.kernel.org
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	[thread overview]
Message-ID: <2CF5220A-5452-4913-AFCB-41E1C642E521@redhat.com> (raw)
In-Reply-To: <89e1dbcd-605d-6a7b-361-c130f7eb9d8c@google.com>


> Am 28.01.2021 um 23:28 schrieb David Rientjes <rientjes@google.com>:
> 
> On Thu, 28 Jan 2021, David Hildenbrand wrote:
> 
>>> On Thu, 28 Jan 2021, David Hildenbrand wrote:
>>> 
>>>> 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
>>>> 
>>>>   seq_printf(m,
>>>>          "\n        protection: (%ld",
>>> 
>>> Hmm, not sure about this.  If cma is only printed for CONFIG_CMA, we can't 
>>> distinguish between (1) a kernel without your patch without including some 
>>> version checking and (2) a kernel without CONFIG_CMA enabled.  IOW, 
>>> "cma 0" carries value: we know immediately that we do not have any CMA 
>>> pages on this zone, period.
>>> 
>>> /proc/zoneinfo is also not known for its conciseness so I think printing 
>>> "cma 0" even for !CONFIG_CMA is helpful :)
>>> 
>>> I think this #ifdef should be removed and it should call into a 
>>> zone_cma_pages(struct zone *zone) which returns 0UL if disabled.
>>> 
>> 
>> Yeah, that’s also what I proposed in a sub-thread here.
>> 
> 
> Ah, I certainly think your original intuition was correct.
> 
>> 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 counter ;)
>> 
>> I don‘t particularly care, while printing „0“ might be easier, removing nr_free_cma might be cleaner.
>> 
>> But then, maybe there are tools that expect that value to be around on any kernel?
>> 
> 
> Yeah, that's probably undue risk, the ship has sailed and there's no 
> significant upside.
> 
> I still think "cma 0" in /proc/zoneinfo carries value, though, especially 
> for NUMA and it looks like this is how it's done in linux-next.  With a 
> single read of the file, userspace can make the determination what CMA 
> pages exist on this node.
> 
> In general, I think the rule-of-thumb is that the fewer ifdefs in 
> /proc/zoneinfo, the easier it is for userspace to parse it.

Makes sense, I‘ll send an updated version tomorrow - thanks!


> 
> (I made that change to /proc/zoneinfo to even print non-existant zones for 
> each node because otherwise you cannot determine what the indices of 
> things like vm.lowmem_reserve_ratio represent.)



  reply	other threads:[~2021-01-28 22:30 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-27 10:18 [PATCH v1 0/2] mm/cma: better error handling and count pages per zone David Hildenbrand
2021-01-27 10:18 ` [PATCH v1 1/2] mm/cma: expose all pages to the buddy if activation of an area fails David Hildenbrand
2021-01-27 15:58   ` Zi Yan
2021-01-28  9:59   ` Oscar Salvador
2021-01-27 10:18 ` [PATCH v1 2/2] mm/page_alloc: count CMA pages per zone and print them in /proc/zoneinfo David Hildenbrand
2021-01-28 10:22   ` Oscar Salvador
2021-01-28 10:43     ` David Hildenbrand
2021-01-28 13:44       ` Oscar Salvador
2021-01-28 13:46         ` Oscar Salvador
2021-01-28 14:01         ` David Hildenbrand
2021-01-28 16:45   ` [PATCH v2] " David Hildenbrand
2021-01-28 21:42     ` Oscar Salvador
2021-01-28 21:54     ` David Rientjes
2021-01-28 22:03       ` David Hildenbrand
2021-01-28 22:28         ` David Rientjes
2021-01-28 22:30           ` David Hildenbrand [this message]
2021-01-29 11:34   ` [PATCH v3] " David Hildenbrand
2021-01-29 11:46     ` Oscar Salvador
2021-01-29 11:51       ` David Hildenbrand
2021-01-30  8:48     ` David Rientjes

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2CF5220A-5452-4913-AFCB-41E1C642E521@redhat.com \
    --to=david@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-api@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=osalvador@suse.de \
    --cc=peterz@infradead.org \
    --cc=richard.weiyang@linux.alibaba.com \
    --cc=rientjes@google.com \
    --cc=rppt@kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).