lkml.org 
[lkml]   [2013]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: ipc,sem: sysv semaphore scalability
On 03/31/2013 01:01 AM, Davidlohr Bueso wrote:

> diff --git a/ipc/sem.c b/ipc/sem.c
> index f257afe..74cedfe 100644
> --- a/ipc/sem.c
> +++ b/ipc/sem.c
> @@ -1867,8 +1867,7 @@ void exit_sem(struct task_struct *tsk)
> struct sem_array *sma;
> struct sem_undo *un;
> struct list_head tasks;
> - int semid;
> - int i;
> + int semid, i;
>
> rcu_read_lock();
> un = list_entry_rcu(ulp->list_proc.next,
> @@ -1884,12 +1883,13 @@ void exit_sem(struct task_struct *tsk)
> }
>
> sma = sem_obtain_object_check(tsk->nsproxy->ipc_ns, un->semid);

Should we use "semid" here, like Linus suggested, instead of "un->semid"?

> - sem_lock(sma, NULL, -1);
> -
> /* exit_sem raced with IPC_RMID, nothing to do */
> - if (IS_ERR(sma))
> + if (IS_ERR(sma)) {
> + rcu_read_unlock();
> continue;
> + }
>
> + sem_lock(sma, NULL, -1);
> un = __lookup_undo(ulp, semid);
> if (un == NULL) {
> /* exit_sem raced with IPC_RMID+semget() that created
>

--
All rights reversed.


\
 
 \ /
  Last update: 2013-03-31 16:41    [W:0.150 / U:3.156 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site