Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 176696
b: refs/heads/master
c: d987f8b
h: refs/heads/master
v: v3
  • Loading branch information
Manfred Spraul authored and Linus Torvalds committed Dec 16, 2009
1 parent 640bb07 commit e387866
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 636c6be823870d829b37fc96655bb8820a6a9be9
refs/heads/master: d987f8b213f2cdcc52b2ca9ee67161516e4d256a
11 changes: 11 additions & 0 deletions trunk/ipc/sem.c
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,17 @@ static void update_queue(struct sem_array *sma, int semnum)
q = (struct sem_queue *)((char *)walk - offset);
walk = walk->next;

/* If we are scanning the single sop, per-semaphore list of
* one semaphore and that semaphore is 0, then it is not
* necessary to scan the "alter" entries: simple increments
* that affect only one entry succeed immediately and cannot
* be in the per semaphore pending queue, and decrements
* cannot be successful if the value is already 0.
*/
if (semnum != -1 && sma->sem_base[semnum].semval == 0 &&
q->alter)
break;

error = try_atomic_semop(sma, q->sops, q->nsops,
q->undo, q->pid);

Expand Down

0 comments on commit e387866

Please sign in to comment.