Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965661Ab3DPXao (ORCPT ); Tue, 16 Apr 2013 19:30:44 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:56970 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965617Ab3DPXan (ORCPT ); Tue, 16 Apr 2013 19:30:43 -0400 Date: Tue, 16 Apr 2013 16:30:41 -0700 From: Andrew Morton To: Davidlohr Bueso , Emmanuel Benisty , Linus Torvalds , Rik van Riel , Linux Kernel Mailing List , hhuang@redhat.com, "Low, Jason" , Michel Lespinasse , Larry Woodman , "Vinod, Chegu" Subject: Re: ipc,sem: sysv semaphore scalability Message-Id: <20130416163041.dfa3e82bfa6b10ae8ffe7608@linux-foundation.org> In-Reply-To: <20130326113533.41ad9ee33b2d010b2a83e7c0@linux-foundation.org> References: <1363809337-29718-1-git-send-email-riel@surriel.com> <1364320767.5146.11.camel@buesod1.americas.hpqcorp.net> <20130326113533.41ad9ee33b2d010b2a83e7c0@linux-foundation.org> X-Mailer: Sylpheed 3.2.0beta5 (GTK+ 2.24.10; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 899 Lines: 27 On Tue, 26 Mar 2013 11:35:33 -0700 Andrew Morton wrote: > Do we need the locking at all? What does it actually do? > > sem_lock_and_putref(sma); > if (sma->sem_perm.deleted) { > sem_unlock(sma, -1); > err = -EIDRM; > goto out_free; > } > sem_unlock(sma, -1); > > We're taking the lock, testing an int and then dropping the lock. > What's the point in that? Rikpoke. The new semctl_main() is now taking a lock, testing sma->sem_perm.deleted then dropping that lock. It looks wrong. What is that lock testing against? What prevents .deleted from changing value 1ns after we dropped that lock? -- 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/