aboutsummaryrefslogtreecommitdiffstats
path: root/ipc
diff options
context:
space:
mode:
Diffstat (limited to 'ipc')
-rw-r--r--ipc/sem.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/ipc/sem.c b/ipc/sem.c
index 7eb6f049dd7c..82518d6a96a3 100644
--- a/ipc/sem.c
+++ b/ipc/sem.c
@@ -474,6 +474,17 @@ again:
474 q = (struct sem_queue *)((char *)walk - offset); 474 q = (struct sem_queue *)((char *)walk - offset);
475 walk = walk->next; 475 walk = walk->next;
476 476
477 /* If we are scanning the single sop, per-semaphore list of
478 * one semaphore and that semaphore is 0, then it is not
479 * necessary to scan the "alter" entries: simple increments
480 * that affect only one entry succeed immediately and cannot
481 * be in the per semaphore pending queue, and decrements
482 * cannot be successful if the value is already 0.
483 */
484 if (semnum != -1 && sma->sem_base[semnum].semval == 0 &&
485 q->alter)
486 break;
487
477 error = try_atomic_semop(sma, q->sops, q->nsops, 488 error = try_atomic_semop(sma, q->sops, q->nsops,
478 q->undo, q->pid); 489 q->undo, q->pid);
479 490