From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752116Ab1HXVn1 (ORCPT ); Wed, 24 Aug 2011 17:43:27 -0400 Received: from claw.goop.org ([74.207.240.146]:53602 "EHLO claw.goop.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751991Ab1HXVnY (ORCPT ); Wed, 24 Aug 2011 17:43:24 -0400 Message-ID: <4E55707A.2080102@goop.org> Date: Wed, 24 Aug 2011 14:43:22 -0700 From: Jeremy Fitzhardinge User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:6.0) Gecko/20110816 Thunderbird/6.0 MIME-Version: 1.0 To: Linus Torvalds CC: Andi Kleen , "H. Peter Anvin" , Peter Zijlstra , Ingo Molnar , the arch/x86 maintainers , Linux Kernel Mailing List , Nick Piggin , Jeremy Fitzhardinge Subject: Re: [PATCH 06/18] x86/ticketlock: make __ticket_spin_trylock common References: In-Reply-To: X-Enigmail-Version: 1.3.1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/24/2011 02:38 PM, Linus Torvalds wrote: > Many data structures have spinlocks inside of them, and the smaller > spinlock *should* be able to result in smaller data structures. > > Of course, that assumes that they have been packed correctly. And they > seldom are ;( > > Looking at 'struct task_struct', for example, the spinlocks there > aren't next to each other, and have pointers and 'unsigned int's > around them, so rather than shrinking the data structure, it just > results in holes. Wouldn't sticking all the spinlocks together just result in false sharing? Wouldn't it be best to put them right next to the fields they protect so the act of getting the lock also gets you your data? J