lkml.org 
[lkml]   [2023]   [Aug]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] mm: memcg: provide accurate stats for userspace reads
From

On 8/14/23 20:35, Tejun Heo wrote:
> Hello,
>
> On Mon, Aug 14, 2023 at 05:28:22PM -0700, Yosry Ahmed wrote:
>>> So, the original design used mutex for synchronize flushing with the idea
>>> being that updates are high freq but reads are low freq and can be
>>> relatively slow. Using rstats for mm internal operations changed this
>>> assumption quite a bit and we ended up switching that mutex with a lock.
>> Naive question, do mutexes handle thundering herd problems better than
>> spinlocks? I would assume so but I am not sure.
> I don't know. We can ask Waiman if that becomes a problem.

We had essentially solved the thundering herd problems for both
spinlocks and mutexes. Both types of lock waiters will spin in their own
cachelines (in the OSP wait queue in the case of mutex) except one that
is at the head of the queue. So there should be minimal cacheline
bouncing. One should certainly uses mutexes in sleep-able context or
when the critical section is long.

Cheers,
Longman

\
 
 \ /
  Last update: 2023-08-15 17:47    [W:0.057 / U:0.252 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site