[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <eaedbf35-18a9-852e-e263-c79224f9d5e8@suse.cz>
Date: Wed, 15 Jul 2020 13:20:17 +0200
From: Vlastimil Babka <vbabka@...e.cz>
To: Roman Gushchin <guro@...com>,
Andrew Morton <akpm@...ux-foundation.org>
Cc: Johannes Weiner <hannes@...xchg.org>,
Michal Hocko <mhocko@...nel.org>, linux-mm@...ck.org,
kernel-team@...com, linux-kernel@...r.kernel.org,
Hugh Dickins <hughd@...gle.com>
Subject: Re: [PATCH] mm: vmstat: fix /proc/sys/vm/stat_refresh generating
false warnings
On 7/14/20 7:37 PM, Roman Gushchin wrote:
> I've noticed a number of warnings like "vmstat_refresh: nr_free_cma
> -5" or "vmstat_refresh: nr_zone_write_pending -11" on our production
> hosts. The numbers of these warnings were relatively low and stable,
> so it didn't look like we are systematically leaking the counters.
> The corresponding vmstat counters also looked sane.
>
> These warnings are generated by the vmstat_refresh() function, which
> assumes that atomic zone and numa counters can't go below zero.
> However, on a SMP machine it's not quite right: due to per-cpu
> caching it can in theory be as low as -(zone threshold) * NR_CPUs.
>
> For instance, let's say all cma pages are in use and NR_FREE_CMA_PAGES
> reached 0. Then we've reclaimed a small number of cma pages on each
> CPU except CPU0, so that most percpu NR_FREE_CMA_PAGES counters are
> slightly positive (the atomic counter is still 0). Then somebody on
> CPU0 consumes all these pages. The number of pages can easily exceed
> the threshold and a negative value will be committed to the atomic
> counter.
>
> To fix the problem and avoid generating false warnings, let's just
> relax the condition and warn only if the value is less than minus
> the maximum theoretically possible drift value, which is 125 *
> number of online CPUs. It will still allow to catch systematic leaks,
> but will not generate bogus warnings.
>
> Signed-off-by: Roman Gushchin <guro@...com>
> Cc: Hugh Dickins <hughd@...gle.com>
> Signed-off-by: Roman Gushchin <guro@...com>
Acked-by: Vlastimil Babka <vbabka@...e.cz>
Powered by blists - more mailing lists