From: Guru Anbalagane Date: Tue, 13 Sep 2011 19:10:13 +0000 (-0700) Subject: Revert "ipc semaphores: order wakeups based on waiter CPU" X-Git-Tag: v2.6.39-400.9.0~913 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=6c92631b5aabae8bbc98e5090cd85dde4ee72710;p=users%2Fjedix%2Flinux-maple.git Revert "ipc semaphores: order wakeups based on waiter CPU" This reverts commit 8102e1ff9d667661b581209323faaf7a84f0f528. --- diff --git a/include/linux/sem.h b/include/linux/sem.h index 15da841d11614..5a97a370c71de 100644 --- a/include/linux/sem.h +++ b/include/linux/sem.h @@ -106,7 +106,6 @@ struct sem_array { struct sem_queue { struct list_head list; /* queue of pending operations */ struct task_struct *sleeper; /* this process */ - unsigned long sleep_cpu; struct sem_undo *undo; /* undo structure */ int pid; /* process id of requesting process */ int status; /* completion status of operation */ diff --git a/ipc/sem.c b/ipc/sem.c index d34316d8a9244..4643652be3f53 100644 --- a/ipc/sem.c +++ b/ipc/sem.c @@ -572,25 +572,6 @@ static void wake_up_sem_queue_do(struct list_head *pt) preempt_enable(); } -/* - * sorting helper for struct sem_queues in a list. This is used to - * sort by the CPU they are likely to be on when waking them. - */ -int list_comp(void *priv, struct list_head *a, struct list_head *b) -{ - struct sem_queue *qa; - struct sem_queue *qb; - - qa = list_entry(a, struct sem_queue, list); - qb = list_entry(b, struct sem_queue, list); - - if (qa->sleep_cpu < qb->sleep_cpu) - return -1; - if (qa->sleep_cpu > qb->sleep_cpu) - return 1; - return 0; -} - /** * update_queue(sma, semnum): Look for tasks that can be completed. * @sma: semaphore array. @@ -610,7 +591,6 @@ static int update_queue(struct sem_array *sma, struct list_head *pt, struct sem_queue *q; LIST_HEAD(new_pending); LIST_HEAD(work_list); - LIST_HEAD(wake_list); int semop_completed = 0; /* @@ -650,24 +630,13 @@ again: if (!error) semop_completed = 1; - if (error) - wake_up_sem_queue_prepare(pt, q, error); - else - list_add_tail(&q->list, &wake_list); + wake_up_sem_queue_prepare(pt, q, error); if (!list_empty(&new_pending)) { list_splice_init(&new_pending, &work_list); goto again; } } - - list_sort(NULL, &wake_list, list_comp); - while (!list_empty(&wake_list)) { - q = list_entry(wake_list.next, struct sem_queue, list); - list_del_init(&q->list); - wake_up_sem_queue_prepare(pt, q, 0); - } - return semop_completed; } @@ -1582,12 +1551,6 @@ SYSCALL_DEFINE4(semtimedop, int, semid, struct sembuf __user *, tsops, queue.alter = alter; queue.status = -EINTR; queue.sleeper = current; - - /* - * the sleep_cpu number allows sorting by the CPU we expect - * their runqueue entry to be on..hopefully faster for waking up - */ - queue.sleep_cpu = my_cpu_offset; current->state = TASK_INTERRUPTIBLE; /*