[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [RFC PATCH 03/30] Lazy percpu counters
- To: Mel Gorman <mgorman@xxxxxxx>
- From: Suren Baghdasaryan <surenb@xxxxxxxxxx>
- Date: Wed, 31 Aug 2022 08:37:14 -0700
- Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>, Kent Overstreet <kent.overstreet@xxxxxxxxx>, Michal Hocko <mhocko@xxxxxxxx>, Vlastimil Babka <vbabka@xxxxxxx>, Johannes Weiner <hannes@xxxxxxxxxxx>, Roman Gushchin <roman.gushchin@xxxxxxxxx>, Davidlohr Bueso <dave@xxxxxxxxxxxx>, Matthew Wilcox <willy@xxxxxxxxxxxxx>, "Liam R. Howlett" <liam.howlett@xxxxxxxxxx>, David Vernet <void@xxxxxxxxxxxxx>, Peter Zijlstra <peterz@xxxxxxxxxxxxx>, Juri Lelli <juri.lelli@xxxxxxxxxx>, Laurent Dufour <ldufour@xxxxxxxxxxxxx>, Peter Xu <peterx@xxxxxxxxxx>, David Hildenbrand <david@xxxxxxxxxx>, Jens Axboe <axboe@xxxxxxxxx>, mcgrof@xxxxxxxxxx, masahiroy@xxxxxxxxxx, nathan@xxxxxxxxxx, changbin.du@xxxxxxxxx, ytcoode@xxxxxxxxx, Vincent Guittot <vincent.guittot@xxxxxxxxxx>, Dietmar Eggemann <dietmar.eggemann@xxxxxxx>, Steven Rostedt <rostedt@xxxxxxxxxxx>, Benjamin Segall <bsegall@xxxxxxxxxx>, Daniel Bristot de Oliveira <bristot@xxxxxxxxxx>, Valentin Schneider <vschneid@xxxxxxxxxx>, Christopher Lameter <cl@xxxxxxxxx>, Pekka Enberg <penberg@xxxxxxxxxx>, Joonsoo Kim <iamjoonsoo.kim@xxxxxxx>, 42.hyeyoo@xxxxxxxxx, Alexander Potapenko <glider@xxxxxxxxxx>, Marco Elver <elver@xxxxxxxxxx>, dvyukov@xxxxxxxxxx, Shakeel Butt <shakeelb@xxxxxxxxxx>, Muchun Song <songmuchun@xxxxxxxxxxxxx>, arnd@xxxxxxxx, jbaron@xxxxxxxxxx, David Rientjes <rientjes@xxxxxxxxxx>, Minchan Kim <minchan@xxxxxxxxxx>, Kalesh Singh <kaleshsingh@xxxxxxxxxx>, kernel-team <kernel-team@xxxxxxxxxxx>, linux-mm <linux-mm@xxxxxxxxx>, iommu@xxxxxxxxxxxxxxx, kasan-dev@xxxxxxxxxxxxxxxx, io-uring@xxxxxxxxxxxxxxx, linux-arch@xxxxxxxxxxxxxxx, xen-devel@xxxxxxxxxxxxxxxxxxxx, linux-bcache@xxxxxxxxxxxxxxx, linux-modules@xxxxxxxxxxxxxxx, LKML <linux-kernel@xxxxxxxxxxxxxxx>
- Delivery-date: Wed, 31 Aug 2022 15:37:34 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
On Wed, Aug 31, 2022 at 3:02 AM Mel Gorman <mgorman@xxxxxxx> wrote:
>
> On Tue, Aug 30, 2022 at 02:48:52PM -0700, Suren Baghdasaryan wrote:
> > From: Kent Overstreet <kent.overstreet@xxxxxxxxx>
> >
> > This patch adds lib/lazy-percpu-counter.c, which implements counters
> > that start out as atomics, but lazily switch to percpu mode if the
> > update rate crosses some threshold (arbitrarily set at 256 per second).
> >
> > Signed-off-by: Kent Overstreet <kent.overstreet@xxxxxxxxx>
>
> Why not use percpu_counter? It has a per-cpu counter that is synchronised
> when a batch threshold (default 32) is exceeded and can explicitly sync
> the counters when required assuming the synchronised count is only needed
> when reading debugfs.
The intent is to use atomic counters for places that are not updated very often.
This would save memory required for the counters. Originally I had a config
option to choose which counter type to use but with lazy counters we sacrifice
memory for performance only when needed while keeping the other counters
small.
>
> --
> Mel Gorman
> SUSE Labs
|