From: "J. R. Okajima" <hooanon05g@gmail.com>
To: mingo@redhat.com, arjan@linux.intel.com
Cc: linux-kernel@vger.kernel.org
Subject: Q. re-using lock_classes[]
Date: Tue, 11 Dec 2018 02:56:36 +0900 [thread overview]
Message-ID: <879.1544464596@jrobl> (raw)
Hello,
"Troubleshooting" section in Documentation/locking/lockdep-design.txt
describes
----------------------------------------
1. Repeated module loading and unloading while running the validator
will result in lock-class leakage. The issue here is that each
load of the module will create a new set of lock classes for
that module's locks, but module unloading does not remove old
classes (see below discussion of reuse of lock classes for why).
Therefore, if that module is loaded and unloaded repeatedly,
the number of lock classes will eventually reach the maximum.
:::
One might argue that the validator should be modified to allow
lock classes to be reused. However, if you are tempted to make this
argument, first review the code and think through the changes that would
be required, keeping in mind that the lock classes to be removed are
likely to be linked into the lock-dependency graph. This turns out to
be harder to do than to say.
----------------------------------------
I am wondering these
"module unloading does not remove old classes"
"the lock classes to be removed are likely to be linked into the
lock-dependency graph"
sentences are still valid?
Does "the lock-dependency graph" mean
class->hash_entry
class->lock_entry
and/or
list_entries[]?
Those are handled by zap_class() at unloading the module.
Here is my question.
Doesn't zap_class() make the slot in lock_classes[] logically unused?
If so, can we re-use the unused slot by searchng and testing some
members in struct lock_class? For example,
bool test_unused(class)
{
return !rcu_access_pointer(class->name)
&& !rcu_access_pointer(class->key)
&& list_empty(&class->lock_entry)
&& hlist_unhashed(&class->hash_entry);
}
Though a new function list_del_init_rcu() for zap_class() will be
necessary.
J. R. Okajima
reply other threads:[~2018-12-10 18:03 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=879.1544464596@jrobl \
--to=hooanon05g@gmail.com \
--cc=arjan@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox