From owner-freebsd-mips@FreeBSD.ORG Mon Nov 5 17:11:56 2012 Return-Path: Delivered-To: freebsd-mips@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id F2AD2F4 for ; Mon, 5 Nov 2012 17:11:55 +0000 (UTC) (envelope-from imp@bsdimp.com) Received: from mail-ia0-f182.google.com (mail-ia0-f182.google.com [209.85.210.182]) by mx1.freebsd.org (Postfix) with ESMTP id A6DC98FC08 for ; Mon, 5 Nov 2012 17:11:55 +0000 (UTC) Received: by mail-ia0-f182.google.com with SMTP id k10so5809001iag.13 for ; Mon, 05 Nov 2012 09:11:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=sender:subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to:x-mailer :x-gm-message-state; bh=ohCkejbTpmRf67jvUm9RDO6WRpDDG7G8bigMpwxEM0E=; b=F/ZgYZwXLaSjtJvAiFBmIu4w/jby3QDwXdGsuhW8GjYbuX9azIyfMm//nxaXZfVKnR J64K+UgZyqch0ZWqxWvOabNV4DthrTy3y9F1TtMjk39GEDUyyq5cFB9dWAS2WcdCA0wM kMEKA9s/0bbE+kUDz9kqaJCKsH2Uux1uApMJa0ErHD3hwq+1aZFh+32v90asNKx+oPB8 xd8QEFX7o3649LDIvJ3v7P6fB2H2AglVuuRWQHIWTBMrNpZEKoutLdHVfjsWY/dbFPsv Z6uUy/X6iLz2iB2YSGLDpB2GMCxXPx8o816br3zzJ6gUzmCoqAyQAw0DPC1nk/ecaOoi fCHQ== Received: by 10.50.222.226 with SMTP id qp2mr10060925igc.74.1352135515140; Mon, 05 Nov 2012 09:11:55 -0800 (PST) Received: from 53.imp.bsdimp.com (50-78-194-198-static.hfc.comcastbusiness.net. [50.78.194.198]) by mx.google.com with ESMTPS id i10sm6081219igb.12.2012.11.05.09.11.53 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 05 Nov 2012 09:11:54 -0800 (PST) Sender: Warner Losh Subject: Re: CACHE_LINE_SIZE macro. Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii From: Warner Losh In-Reply-To: Date: Mon, 5 Nov 2012 10:11:52 -0700 Content-Transfer-Encoding: quoted-printable Message-Id: References: <201211041828.qA4ISomC076058@pdx.rh.CN85.ChatUSA.com> To: Eitan Adler X-Mailer: Apple Mail (2.1084) X-Gm-Message-State: ALoCoQnU/JUWXWUW19YU0oLmM18ktcK5O712od1A3/pPCanY0ej/PjhcEgKZyXrASFqcX72trNnV Cc: "Rodney W. Grimes" , Juli Mallett , "freebsd-mips@FreeBSD.org" X-BeenThere: freebsd-mips@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to MIPS List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 05 Nov 2012 17:11:56 -0000 On Nov 5, 2012, at 10:01 AM, Eitan Adler wrote: > On 5 November 2012 11:49, Warner Losh wrote: >>> There has been some discussion recently about padding lock mutexs to >>> the cache line size in order to avoid false sharing of CPUs. Some = have >>> claimed to see significant performance increases as a result. >>=20 >> Is that an out-of-kernel interface? >>=20 >> If we did that, we'd have to make it run-time settable, because = there's no one right answer for arm and MIPS cpus: they are all = different. >=20 > The discussion ended up with using a special parameter > CACHE_LINE_SIZE_LOCKS which is different than CACHE_LINE_SIZE. This is > necessary for other reasons as well (CACHE_LINE_SIZE_LOCKS may take > into account prefetching of cache lines, but CACHE_LINE_SIZE > wouldn't). >=20 > I think the "correct" thing to do here is choose a reasonable, but > not-always-correct CACHE_LINE_SIZE_LOCKS and make CACHE_LINE_SIZE a > per-board constant (or run time setting, or whatever works). You > can't make it run-time settable as the padding is part of the ABI: >=20 > For more details see > http://comments.gmane.org/gmane.os.freebsd.devel.cvs/483696 > which contains the original discussion. >=20 > Note - I was not involved. this is a kernel-only interface, so compile time constants are fine = there. What user-land visible interfaces are affected by this setting? = The answer should be 'none' Warner