From owner-svn-src-user@FreeBSD.ORG Thu Oct 25 19:05:43 2012 Return-Path: Delivered-To: svn-src-user@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 49810968; Thu, 25 Oct 2012 19:05:43 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-pa0-f54.google.com (mail-pa0-f54.google.com [209.85.220.54]) by mx1.freebsd.org (Postfix) with ESMTP id EBC6B8FC14; Thu, 25 Oct 2012 19:05:42 +0000 (UTC) Received: by mail-pa0-f54.google.com with SMTP id bi1so1482783pad.13 for ; Thu, 25 Oct 2012 12:05:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=u8p4/zTXTHJWo/v41RN7rLx5q5ICdvkSCgAVnbDJeFY=; b=Xypi/29BQv3YhIbNp753v5iYDP8RwxtHUEbJYJ+vm9kTj34hPLnx5fyLHQrbQFp51q 0nHSGWXURMo7PxITT0V6Rr4le6WIvDb+MNtlHLkQIdExEyd1p6DDAS6f89ZxnREbpcII DJOQD8HxyuK3agLuBxpBPxzUSfhfZsNY8hUKfda7QysjIgsKSP3PmwA3aP3mdagmbo9V jAH+KExPF6oZ6NuE9qPbbmsxiZe4tcVJX4Nq3hpuEQfSYbxPF2sCmAnSNcx1JinkCXGY Kp4PzxiEu3eAy3L5/mPkiUS7z20FBDFQDnk/7kW48ECu62cMAuj6qprogcv4csv6ev7k fChw== MIME-Version: 1.0 Received: by 10.68.132.165 with SMTP id ov5mr61733274pbb.105.1351191942621; Thu, 25 Oct 2012 12:05:42 -0700 (PDT) Sender: mdf356@gmail.com Received: by 10.68.223.105 with HTTP; Thu, 25 Oct 2012 12:05:42 -0700 (PDT) In-Reply-To: <508965B3.2020705@freebsd.org> References: <201210221418.q9MEINkr026751@svn.freebsd.org> <201210241136.06154.jhb@freebsd.org> <201210241414.30723.jhb@freebsd.org> <508965B3.2020705@freebsd.org> Date: Thu, 25 Oct 2012 12:05:42 -0700 X-Google-Sender-Auth: sxPPqmuO0caMK5pNo0lJR0xfOxk Message-ID: Subject: Re: svn commit: r241889 - in user/andre/tcp_workqueue/sys: arm/arm cddl/compat/opensolaris/kern cddl/contrib/opensolaris/uts/common/dtrace cddl/contrib/opensolaris/uts/common/fs/zfs ddb dev/acpica dev/... From: mdf@FreeBSD.org To: Andre Oppermann Content-Type: text/plain; charset=ISO-8859-1 Cc: src-committers@freebsd.org, John Baldwin , svn-src-user@freebsd.org, attilio@freebsd.org, Jeff Roberson , Bruce Evans X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Oct 2012 19:05:43 -0000 On Thu, Oct 25, 2012 at 9:15 AM, Andre Oppermann wrote: > I think we're completely overdoing it. I agree, but in the opposite direction. This is a solution looking for a problem. > On amd64 the size difference > of 64B cache line aligning and padding all mutex, sx and rw_lock > structures adds the tiny amount of 16K on a GENERIC kernel of 19MB. > That is a 0.009% increase in size. Of course dynamically allocated > memory that includes a mutex grows a tiny bit at well. > > Hence I propose to unconditionally slap __aligned(CACHE_LINE_SIZE) into > all locking structures and be done with it. As an added benefit we > don't have to worry about individual micro-optimizations on a case by > case basis. What problem are you trying to solve? I understand all about cache sharing, but if you force struct mtx to take its own cache line, I now have no ability to put data accessed under the lock in the same cache line. You've de-optimized code and memory layout. And like alc@ said, ignored the mtx embedded in many dynamically allocated structures. If certain, specific global mutexes will benefit, then they can be explicitly allocated as __aligned and explicitly padded to a cache line. No other mtx except ones specifically identified as making a performance difference should be touched. There is no need for a general solution. Thanks, matthew