Skip to content

Commit 79637a4

Browse files
committed
Merge branch 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip
* 'core-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip: gcc-4.6: kernel/*: Fix unused but set warnings mutex: Fix annotations to include it in kernel-locking docbook pid: make setpgid() system call use RCU read-side critical section MAINTAINERS: Add RCU's public git tree
2 parents 899edae + b3bd3de commit 79637a4

11 files changed

Lines changed: 30 additions & 29 deletions

File tree

Documentation/DocBook/kernel-locking.tmpl

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1961,6 +1961,12 @@ machines due to caching.
19611961
</sect1>
19621962
</chapter>
19631963

1964+
<chapter id="apiref">
1965+
<title>Mutex API reference</title>
1966+
!Iinclude/linux/mutex.h
1967+
!Ekernel/mutex.c
1968+
</chapter>
1969+
19641970
<chapter id="references">
19651971
<title>Further reading</title>
19661972

Documentation/mutex-design.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ firstly, there's nothing wrong with semaphores. But if the simpler
99
mutex semantics are sufficient for your code, then there are a couple
1010
of advantages of mutexes:
1111

12-
- 'struct mutex' is smaller on most architectures: .e.g on x86,
12+
- 'struct mutex' is smaller on most architectures: E.g. on x86,
1313
'struct semaphore' is 20 bytes, 'struct mutex' is 16 bytes.
1414
A smaller structure size means less RAM footprint, and better
1515
CPU-cache utilization.
@@ -136,3 +136,4 @@ the APIs of 'struct mutex' have been streamlined:
136136
void mutex_lock_nested(struct mutex *lock, unsigned int subclass);
137137
int mutex_lock_interruptible_nested(struct mutex *lock,
138138
unsigned int subclass);
139+
int atomic_dec_and_mutex_lock(atomic_t *cnt, struct mutex *lock);

MAINTAINERS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4810,6 +4810,7 @@ RCUTORTURE MODULE
48104810
M: Josh Triplett <josh@freedesktop.org>
48114811
M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
48124812
S: Supported
4813+
T: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
48134814
F: Documentation/RCU/torture.txt
48144815
F: kernel/rcutorture.c
48154816

@@ -4834,6 +4835,7 @@ M: Dipankar Sarma <dipankar@in.ibm.com>
48344835
M: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
48354836
W: http://www.rdrop.com/users/paulmck/rclock/
48364837
S: Supported
4838+
T: git://git.kernel.org/pub/scm/linux/kernel/git/paulmck/linux-2.6-rcu.git
48374839
F: Documentation/RCU/
48384840
F: include/linux/rcu*
48394841
F: include/linux/srcu*

include/linux/mutex.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,14 @@ struct mutex_waiter {
7878
# include <linux/mutex-debug.h>
7979
#else
8080
# define __DEBUG_MUTEX_INITIALIZER(lockname)
81+
/**
82+
* mutex_init - initialize the mutex
83+
* @mutex: the mutex to be initialized
84+
*
85+
* Initialize the mutex to unlocked state.
86+
*
87+
* It is not allowed to initialize an already locked mutex.
88+
*/
8189
# define mutex_init(mutex) \
8290
do { \
8391
static struct lock_class_key __key; \

kernel/debug/kdb/kdb_bp.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,6 @@ static int kdb_bp(int argc, const char **argv)
274274
int i, bpno;
275275
kdb_bp_t *bp, *bp_check;
276276
int diag;
277-
int free;
278277
char *symname = NULL;
279278
long offset = 0ul;
280279
int nextarg;
@@ -305,7 +304,6 @@ static int kdb_bp(int argc, const char **argv)
305304
/*
306305
* Find an empty bp structure to allocate
307306
*/
308-
free = KDB_MAXBPT;
309307
for (bpno = 0, bp = kdb_breakpoints; bpno < KDB_MAXBPT; bpno++, bp++) {
310308
if (bp->bp_free)
311309
break;

kernel/hrtimer.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,11 +1091,10 @@ EXPORT_SYMBOL_GPL(hrtimer_cancel);
10911091
*/
10921092
ktime_t hrtimer_get_remaining(const struct hrtimer *timer)
10931093
{
1094-
struct hrtimer_clock_base *base;
10951094
unsigned long flags;
10961095
ktime_t rem;
10971096

1098-
base = lock_hrtimer_base(timer, &flags);
1097+
lock_hrtimer_base(timer, &flags);
10991098
rem = hrtimer_expires_remaining(timer);
11001099
unlock_hrtimer_base(timer, &flags);
11011100

kernel/mutex.c

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,6 @@
3636
# include <asm/mutex.h>
3737
#endif
3838

39-
/***
40-
* mutex_init - initialize the mutex
41-
* @lock: the mutex to be initialized
42-
* @key: the lock_class_key for the class; used by mutex lock debugging
43-
*
44-
* Initialize the mutex to unlocked state.
45-
*
46-
* It is not allowed to initialize an already locked mutex.
47-
*/
4839
void
4940
__mutex_init(struct mutex *lock, const char *name, struct lock_class_key *key)
5041
{
@@ -68,7 +59,7 @@ EXPORT_SYMBOL(__mutex_init);
6859
static __used noinline void __sched
6960
__mutex_lock_slowpath(atomic_t *lock_count);
7061

71-
/***
62+
/**
7263
* mutex_lock - acquire the mutex
7364
* @lock: the mutex to be acquired
7465
*
@@ -105,7 +96,7 @@ EXPORT_SYMBOL(mutex_lock);
10596

10697
static __used noinline void __sched __mutex_unlock_slowpath(atomic_t *lock_count);
10798

108-
/***
99+
/**
109100
* mutex_unlock - release the mutex
110101
* @lock: the mutex to be released
111102
*
@@ -364,8 +355,8 @@ __mutex_lock_killable_slowpath(atomic_t *lock_count);
364355
static noinline int __sched
365356
__mutex_lock_interruptible_slowpath(atomic_t *lock_count);
366357

367-
/***
368-
* mutex_lock_interruptible - acquire the mutex, interruptable
358+
/**
359+
* mutex_lock_interruptible - acquire the mutex, interruptible
369360
* @lock: the mutex to be acquired
370361
*
371362
* Lock the mutex like mutex_lock(), and return 0 if the mutex has
@@ -456,15 +447,15 @@ static inline int __mutex_trylock_slowpath(atomic_t *lock_count)
456447
return prev == 1;
457448
}
458449

459-
/***
460-
* mutex_trylock - try acquire the mutex, without waiting
450+
/**
451+
* mutex_trylock - try to acquire the mutex, without waiting
461452
* @lock: the mutex to be acquired
462453
*
463454
* Try to acquire the mutex atomically. Returns 1 if the mutex
464455
* has been acquired successfully, and 0 on contention.
465456
*
466457
* NOTE: this function follows the spin_trylock() convention, so
467-
* it is negated to the down_trylock() return values! Be careful
458+
* it is negated from the down_trylock() return values! Be careful
468459
* about this when converting semaphore users to mutexes.
469460
*
470461
* This function must not be used in interrupt context. The

kernel/sched_fair.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ static struct sched_group *
13131313
find_idlest_group(struct sched_domain *sd, struct task_struct *p,
13141314
int this_cpu, int load_idx)
13151315
{
1316-
struct sched_group *idlest = NULL, *this = NULL, *group = sd->groups;
1316+
struct sched_group *idlest = NULL, *group = sd->groups;
13171317
unsigned long min_load = ULONG_MAX, this_load = 0;
13181318
int imbalance = 100 + (sd->imbalance_pct-100)/2;
13191319

@@ -1348,7 +1348,6 @@ find_idlest_group(struct sched_domain *sd, struct task_struct *p,
13481348

13491349
if (local_group) {
13501350
this_load = avg_load;
1351-
this = group;
13521351
} else if (avg_load < min_load) {
13531352
min_load = avg_load;
13541353
idlest = group;

kernel/sys.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -931,6 +931,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
931931
pgid = pid;
932932
if (pgid < 0)
933933
return -EINVAL;
934+
rcu_read_lock();
934935

935936
/* From this point forward we keep holding onto the tasklist lock
936937
* so that our parent does not change from under us. -DaveM
@@ -984,6 +985,7 @@ SYSCALL_DEFINE2(setpgid, pid_t, pid, pid_t, pgid)
984985
out:
985986
/* All paths lead to here, thus we are safe. -DaveM */
986987
write_unlock_irq(&tasklist_lock);
988+
rcu_read_unlock();
987989
return err;
988990
}
989991

kernel/sysctl.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1713,10 +1713,7 @@ static __init int sysctl_init(void)
17131713
{
17141714
sysctl_set_parent(NULL, root_table);
17151715
#ifdef CONFIG_SYSCTL_SYSCALL_CHECK
1716-
{
1717-
int err;
1718-
err = sysctl_check_table(current->nsproxy, root_table);
1719-
}
1716+
sysctl_check_table(current->nsproxy, root_table);
17201717
#endif
17211718
return 0;
17221719
}

0 commit comments

Comments
 (0)