Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755301Ab3CaNpt (ORCPT ); Sun, 31 Mar 2013 09:45:49 -0400 Received: from shelob.surriel.com ([74.92.59.67]:49690 "EHLO shelob.surriel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754960Ab3CaNpr (ORCPT ); Sun, 31 Mar 2013 09:45:47 -0400 Message-ID: <51583E01.5030106@surriel.com> Date: Sun, 31 Mar 2013 09:45:37 -0400 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130110 Thunderbird/17.0.2 MIME-Version: 1.0 To: Davidlohr Bueso CC: Emmanuel Benisty , Linus Torvalds , Dave Jones , Andrew Morton , Linux Kernel Mailing List , hhuang@redhat.com, "Low, Jason" , Michel Lespinasse , Larry Woodman , "Vinod, Chegu" , Peter Hurley Subject: Re: ipc,sem: sysv semaphore scalability References: <1363809337-29718-1-git-send-email-riel@surriel.com> <20130321141058.76e028e492f98f6ee6e60353@linux-foundation.org> <20130326192852.GA25899@redhat.com> <20130326124309.077e21a9f59aaa3f3355e09b@linux-foundation.org> <20130329161746.GA8391@redhat.com> <1364609309.1818.8.camel@buesod1.americas.hpqcorp.net> <1364706119.6239.6.camel@buesod1.americas.hpqcorp.net> In-Reply-To: <1364706119.6239.6.camel@buesod1.americas.hpqcorp.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1255 Lines: 45 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. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/