[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dbe336c7d7618db4c56613fa53479c18df1e0b9b.camel@linux.intel.com>
Date: Wed, 07 Sep 2022 15:10:11 -0700
From: Tim Chen <tim.c.chen@...ux.intel.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Jiebin Sun <jiebin.sun@...el.com>, vasily.averin@...ux.dev,
shakeelb@...gle.com, dennis@...nel.org, tj@...nel.org,
cl@...ux.com, ebiederm@...ssion.com, legion@...nel.org,
manfred@...orfullife.com, alexander.mikhalitsyn@...tuozzo.com,
linux-mm@...ck.org, linux-kernel@...r.kernel.org,
tim.c.chen@...el.com, feng.tang@...el.com, ying.huang@...el.com,
tianyou.li@...el.com, wangyang.guo@...el.com
Subject: Re: [PATCH v4] ipc/msg: mitigate the lock contention with percpu
counter
On Wed, 2022-09-07 at 14:34 -0700, Andrew Morton wrote:
>
> I think this concept of a percpu_counter_add() which is massively
> biased to the write side and with very rare reading is a legitimate
> use-case. Perhaps it should become an addition to the formal interface.
> Something like
>
> /*
> * comment goes here
> */
> static inline void percpu_counter_add_local(struct percpu_counter *fbc,
> s64 amount)
> {
> percpu_counter_add_batch(fbc, amount, INT_MAX);
> }
>
> and percpu_counter_sub_local(), I guess.
>
> The only instance I can see is
> block/blk-cgroup-rwstat.h:blkg_rwstat_add() which is using INT_MAX/2
> because it always uses percpu_counter_sum_positive() on the read side.
>
> But that makes two!
Sure. We can create this function and use it for both cases. No objections.
Tim
Powered by blists - more mailing lists