From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752199Ab3B1WkB (ORCPT ); Thu, 28 Feb 2013 17:40:01 -0500 Received: from mx1.redhat.com ([209.132.183.28]:9433 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078Ab3B1Wj6 (ORCPT ); Thu, 28 Feb 2013 17:39:58 -0500 Message-ID: <512FDC82.2060606@redhat.com> Date: Thu, 28 Feb 2013 17:38:58 -0500 From: Rik van Riel User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/17.0 Thunderbird/17.0 MIME-Version: 1.0 To: Linus Torvalds CC: Davidlohr Bueso , Linux Kernel Mailing List , Thomas Gleixner , Steven Rostedt , "Vinod, Chegu" , "Low, Jason" , linux-tip-commits@vger.kernel.org, Peter Zijlstra , "H. Peter Anvin" , Andrew Morton , aquini@redhat.com, Michel Lespinasse , Ingo Molnar , Larry Woodman Subject: Re: [tip:core/locking] x86/smp: Move waiting on contended ticket lock out of line References: <20130206150403.006e5294@cuia.bos.redhat.com> <511C1204.9040608@redhat.com> <511C24A6.8020409@redhat.com> <512E376D.70105@redhat.com> <512E6443.9050603@redhat.com> <512E80E3.7060800@redhat.com> <512EC7F0.60103@redhat.com> <1362024397.1867.28.camel@buesod1.americas.hpqcorp.net> <512F7429.4020103@redhat.com> <512FC89B.6030507@redhat.com> In-Reply-To: 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 On 02/28/2013 04:58 PM, Linus Torvalds wrote: > I'm not seeing any real reason the permission checking couldn't be > done just under the RCU lock, before we get the spinlock. Except for > the fact that the "helper" routines in ipc/util.c are written the way > they are, so it's a layering violation. But I really think that would > be a *reasonably* low-hanging fruit thing to do. I could see doing the permission checks under a seq lock. If the permissions, or any other aspect of the semaphore array changed while we were doing our permission check, we can simply jump back to the top of the function and try again. Protection against IPC_RMID (removal of the semaphore block) can probably be done with RCU. The ugliness of using two kinds of protection may be necessary, since permissions can be modified in-place, and RCU does not seem to do in-place modification... I have been staring at the code for a bit this afternoon, and have yet to come up with a nicer idea :( I am always open to suggestions, though :) > Changing the locking itself to be more fine-grained, and doing it > across many different ipc semaphores would be a major pain. So I do > suspect that the work Michel Lespinasse did is probably worth doing > anyway in addition to at least trying to fix the horrible lack of > scalability of the code a bit. That would certainly be the easy fix.