diff options
| author | Thomas Gleixner <tglx@linutronix.de> | 2004-10-27 18:33:04 -0700 |
|---|---|---|
| committer | Linus Torvalds <torvalds@ppc970.osdl.org> | 2004-10-27 18:33:04 -0700 |
| commit | c83ff1d2b7be6651f369b3687f88f3cf9236b4f6 (patch) | |
| tree | 16c45d8d0e77ccafdb04acc450af91200ac3ab15 /kernel | |
| parent | 41b873ffb13f241b7b046dfff5f03df172458595 (diff) | |
[PATCH] Lock initializer unifying (Core)
To make spinlock/rwlock initialization consistent all over the kernel,
this patch converts explicit lock-initializers into spin_lock_init() and
rwlock_init() calls.
Currently, spinlocks and rwlocks are initialized in two different ways:
lock = SPIN_LOCK_UNLOCKED
spin_lock_init(&lock)
rwlock = RW_LOCK_UNLOCKED
rwlock_init(&rwlock)
this patch converts all explicit lock initializations to
spin_lock_init() or rwlock_init(). (Besides consistency this also helps
automatic lock validators and debugging code.)
The conversion was done with a script, it was verified manually and it
was reviewed, compiled and tested as far as possible on x86, ARM, PPC.
There is no runtime overhead or actual code change resulting out of this
patch, because spin_lock_init() and rwlock_init() are macros and are
thus equivalent to the explicit initialization method.
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/fork.c | 8 | ||||
| -rw-r--r-- | kernel/futex.c | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index 130dc25c95e0..eb689d9ce967 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -293,8 +293,8 @@ static struct mm_struct * mm_init(struct mm_struct * mm) INIT_LIST_HEAD(&mm->mmlist); mm->core_waiters = 0; mm->nr_ptes = 0; - mm->page_table_lock = SPIN_LOCK_UNLOCKED; - mm->ioctx_list_lock = RW_LOCK_UNLOCKED; + spin_lock_init(&mm->page_table_lock); + rwlock_init(&mm->ioctx_list_lock); mm->ioctx_list = NULL; mm->default_kioctx = (struct kioctx)INIT_KIOCTX(mm->default_kioctx, *mm); mm->free_area_cache = TASK_UNMAPPED_BASE; @@ -494,7 +494,7 @@ static inline struct fs_struct *__copy_fs_struct(struct fs_struct *old) /* We don't need to lock fs - think why ;-) */ if (fs) { atomic_set(&fs->count, 1); - fs->lock = RW_LOCK_UNLOCKED; + rwlock_init(&fs->lock); fs->umask = old->umask; read_lock(&old->lock); fs->rootmnt = mntget(old->rootmnt); @@ -576,7 +576,7 @@ static int copy_files(unsigned long clone_flags, struct task_struct * tsk) atomic_set(&newf->count, 1); - newf->file_lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&newf->file_lock); newf->next_fd = 0; newf->max_fds = NR_OPEN_DEFAULT; newf->max_fdset = __FD_SETSIZE; diff --git a/kernel/futex.c b/kernel/futex.c index 9a25d76bd6bd..9ebe9a031439 100644 --- a/kernel/futex.c +++ b/kernel/futex.c @@ -732,7 +732,7 @@ static int __init init(void) for (i = 0; i < ARRAY_SIZE(futex_queues); i++) { INIT_LIST_HEAD(&futex_queues[i].chain); - futex_queues[i].lock = SPIN_LOCK_UNLOCKED; + spin_lock_init(&futex_queues[i].lock); } return 0; } |
