[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <575163430.50481.1644436583757.JavaMail.zimbra@efficios.com>
Date: Wed, 9 Feb 2022 14:56:23 -0500 (EST)
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Namhyung Kim <namhyung@...nel.org>
Cc: Waiman Long <longman@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...nel.org>, Will Deacon <will@...nel.org>,
Boqun Feng <boqun.feng@...il.com>,
linux-kernel <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
rostedt <rostedt@...dmis.org>,
Byungchul Park <byungchul.park@....com>,
Radoslaw Burny <rburny@...gle.com>, Tejun Heo <tj@...nel.org>,
rcu <rcu@...r.kernel.org>, cgroups <cgroups@...r.kernel.org>,
linux-btrfs <linux-btrfs@...r.kernel.org>,
intel-gfx <intel-gfx@...ts.freedesktop.org>,
paulmck <paulmck@...nel.org>
Subject: Re: [RFC 00/12] locking: Separate lock tracepoints from
lockdep/lock_stat (v1)
----- On Feb 9, 2022, at 2:45 PM, Namhyung Kim namhyung@...nel.org wrote:
> On Wed, Feb 9, 2022 at 11:28 AM Mathieu Desnoyers
> <mathieu.desnoyers@...icios.com> wrote:
>>
>> ----- On Feb 9, 2022, at 2:22 PM, Namhyung Kim namhyung@...nel.org wrote:
>> > I'm also concerning dynamic allocated locks in a data structure.
>> > If we keep the info in a hash table, we should delete it when the
>> > lock is gone. I'm not sure we have a good place to hook it up all.
>>
>> I was wondering about this use case as well. Can we make it mandatory to
>> declare the lock "class" (including the name) statically, even though the
>> lock per-se is allocated dynamically ? Then the initialization of the lock
>> embedded within the data structure would simply refer to the lock class
>> definition.
>
> Isn't it still the same if we have static lock classes that the entry needs
> to be deleted from the hash table when it frees the data structure?
> I'm more concerned about free than alloc as there seems to be no
> API to track that in a place.
If the lock class is defined statically, even for dynamically initialized
locks, then its associated object sits either in the core kernel or within
a module.
So if it's in the core kernel, it could be added to the hash table at kernel
init and stay there forever.
If it's in a module, it would be added to the hash table on module load and
removed on module unload. We would have to be careful about how the ftrace
printout to human readable text deals with missing hash table data, because
that printout will happen after buffering, so an untimely module unload could
make this address to string mapping unavailable for a few events. If we care
about getting this corner case right there are a few things we could do as
well.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com
Powered by blists - more mailing lists