cregit-Linux how code gets into the kernel

Release 4.7 kernel/locking/lglock.c

Directory: kernel/locking
/* See include/linux/lglock.h for description */
#include <linux/module.h>
#include <linux/lglock.h>
#include <linux/cpu.h>
#include <linux/string.h>

/*
 * Note there is no uninit, so lglocks cannot be defined in
 * modules (but it's fine to use them from there)
 * Could be added though, just undo lg_lock_init
 */


void lg_lock_init(struct lglock *lg, char *name) { LOCKDEP_INIT_MAP(&lg->lock_dep_map, name, &lg->lock_key, 0); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen31100.00%1100.00%
Total31100.00%1100.00%

EXPORT_SYMBOL(lg_lock_init);
void lg_local_lock(struct lglock *lg) { arch_spinlock_t *lock; preempt_disable(); lock_acquire_shared(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_); lock = this_cpu_ptr(lg->lock); arch_spin_lock(lock); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen4493.62%150.00%
michel lespinassemichel lespinasse36.38%150.00%
Total47100.00%2100.00%

EXPORT_SYMBOL(lg_local_lock);
void lg_local_unlock(struct lglock *lg) { arch_spinlock_t *lock; lock_release(&lg->lock_dep_map, 1, _RET_IP_); lock = this_cpu_ptr(lg->lock); arch_spin_unlock(lock); preempt_enable(); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen4297.67%150.00%
michel lespinassemichel lespinasse12.33%150.00%
Total43100.00%2100.00%

EXPORT_SYMBOL(lg_local_unlock);
void lg_local_lock_cpu(struct lglock *lg, int cpu) { arch_spinlock_t *lock; preempt_disable(); lock_acquire_shared(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_); lock = per_cpu_ptr(lg->lock, cpu); arch_spin_lock(lock); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen4994.23%150.00%
michel lespinassemichel lespinasse35.77%150.00%
Total52100.00%2100.00%

EXPORT_SYMBOL(lg_local_lock_cpu);
void lg_local_unlock_cpu(struct lglock *lg, int cpu) { arch_spinlock_t *lock; lock_release(&lg->lock_dep_map, 1, _RET_IP_); lock = per_cpu_ptr(lg->lock, cpu); arch_spin_unlock(lock); preempt_enable(); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen4797.92%150.00%
michel lespinassemichel lespinasse12.08%150.00%
Total48100.00%2100.00%

EXPORT_SYMBOL(lg_local_unlock_cpu);
void lg_double_lock(struct lglock *lg, int cpu1, int cpu2) { BUG_ON(cpu1 == cpu2); /* lock in cpu order, just like lg_global_lock */ if (cpu2 < cpu1) swap(cpu1, cpu2); preempt_disable(); lock_acquire_shared(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_); arch_spin_lock(per_cpu_ptr(lg->lock, cpu1)); arch_spin_lock(per_cpu_ptr(lg->lock, cpu2)); }

Contributors

PersonTokensPropCommitsCommitProp
peter zijlstrapeter zijlstra80100.00%1100.00%
Total80100.00%1100.00%


void lg_double_unlock(struct lglock *lg, int cpu1, int cpu2) { lock_release(&lg->lock_dep_map, 1, _RET_IP_); arch_spin_unlock(per_cpu_ptr(lg->lock, cpu1)); arch_spin_unlock(per_cpu_ptr(lg->lock, cpu2)); preempt_enable(); }

Contributors

PersonTokensPropCommitsCommitProp
peter zijlstrapeter zijlstra55100.00%1100.00%
Total55100.00%1100.00%


void lg_global_lock(struct lglock *lg) { int i; preempt_disable(); lock_acquire_exclusive(&lg->lock_dep_map, 0, 0, NULL, _RET_IP_); for_each_possible_cpu(i) { arch_spinlock_t *lock; lock = per_cpu_ptr(lg->lock, i); arch_spin_lock(lock); } }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen5594.83%150.00%
michel lespinassemichel lespinasse35.17%150.00%
Total58100.00%2100.00%

EXPORT_SYMBOL(lg_global_lock);
void lg_global_unlock(struct lglock *lg) { int i; lock_release(&lg->lock_dep_map, 1, _RET_IP_); for_each_possible_cpu(i) { arch_spinlock_t *lock; lock = per_cpu_ptr(lg->lock, i); arch_spin_unlock(lock); } preempt_enable(); }

Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen5398.15%150.00%
michel lespinassemichel lespinasse11.85%150.00%
Total54100.00%2100.00%

EXPORT_SYMBOL(lg_global_unlock);

Overall Contributors

PersonTokensPropCommitsCommitProp
andi kleenandi kleen37071.57%133.33%
peter zijlstrapeter zijlstra13526.11%133.33%
michel lespinassemichel lespinasse122.32%133.33%
Total517100.00%3100.00%
Directory: kernel/locking
Information contained on this website is for historical information purposes only and does not indicate or represent copyright ownership.
{% endraw %}