Function report |
Source Code:kernel\locking\lockdep.c |
Create Date:2022-07-28 09:49:45 |
| Last Modify:2020-03-17 14:16:01 | Copyright©Brick |
| home page | Tree |
| Annotation kernel can get tool activity | Download SCCT | Chinese |
Name:Register a lock's class in the hash-table, if the class is not present* yet. Otherwise we look it up. We cache the result in the lock object* itself, so actual lookup of the hash should be once per lock object.
Proto:static struct lock_class *register_lock_class(struct lockdep_map *lock, unsigned int subclass, int force)
Type:struct lock_class
Parameter:
| Type | Parameter | Name |
|---|---|---|
| struct lockdep_map * | lock | |
| unsigned int | subclass | |
| int | force |
| 1182 | DEBUG_LOCKS_WARN_ON(!Some architectures don't define arch_irqs_disabled(), so even if either* definition would be fine we need to use different ones for the time being* to avoid build issues.()) |
| 1184 | class = look_up_lock_class(lock, subclass) |
| 1185 | If Value is more likely to compile time(class) Then Go to out_set_class_cache |
| 1188 | If Not key Then |
| 1191 | Else if Not Is this the address of a static object: && Not Check whether a key has been registered as a dynamic key. Then |
| 1192 | Return NULL |
| 1196 | hash_head = classhashentry(key) |
| 1198 | If Not graph_lock() Then |
| 1199 | Return NULL |
| 1206 | If key == key Then Go to out_unlock_set |
| 1215 | If Not class Then |
| 1217 | Return NULL |
| 1220 | print_lockdep_off("BUG: MAX_LOCKDEP_KEYS too low!") |
| 1221 | dump_stack() |
| 1222 | Return NULL |
| 1224 | nr_lock_classes++ |
| 1232 | name_version = To make lock name printouts unique, we calculate a unique* class->name_version generation counter. The caller must hold the graph* lock. |
| 1245 | graph_unlock() |
| 1251 | dump_stack() |
| 1253 | If Not graph_lock() Then |
| 1254 | Return NULL |
| 1257 | out_unlock_set : |
| 1258 | graph_unlock() |
| 1260 | out_set_class_cache : |
| 1261 | If Not subclass || force Then class_cache[0] = class |
| 1263 | Else if subclass < NR_LOCKDEP_CACHING_CLASSES Then class_cache[subclass] = class |
| 1270 | If DEBUG_LOCKS_WARN_ON(subclass != subclass) Then Return NULL |
| 1273 | Return class |
| Name | Describe |
|---|---|
| lockdep_init_map | Initialize a lock instance's lock-class mapping info: |
| __lock_acquire | This gets called for every mutex_lock*()/spin_lock*() operation |
| __lock_set_class |
| Source code conversion tool public plug-in interface | X |
|---|---|
| Support c/c++/esqlc/java Oracle/Informix/Mysql Plug-in can realize: logical Report Code generation and batch code conversion |