From owner-freebsd-arch@FreeBSD.ORG Sat Apr 11 21:10:05 2009 Return-Path: Delivered-To: arch@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5FBA8106566C; Sat, 11 Apr 2009 21:10:05 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from fallbackmx08.syd.optusnet.com.au (fallbackmx08.syd.optusnet.com.au [211.29.132.10]) by mx1.freebsd.org (Postfix) with ESMTP id D4F0B8FC18; Sat, 11 Apr 2009 21:10:04 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail06.syd.optusnet.com.au (mail06.syd.optusnet.com.au [211.29.132.187]) by fallbackmx08.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3BIPtZF029573; Sun, 12 Apr 2009 04:25:55 +1000 Received: from besplex.bde.org (c122-107-120-227.carlnfd1.nsw.optusnet.com.au [122.107.120.227]) by mail06.syd.optusnet.com.au (8.13.1/8.13.1) with ESMTP id n3BIPqeo012749 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sun, 12 Apr 2009 04:25:53 +1000 Date: Sun, 12 Apr 2009 04:25:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Jason Evans In-Reply-To: <49E0C7D3.1010005@FreeBSD.org> Message-ID: <20090412041840.F4999@besplex.bde.org> References: <49E0C7D3.1010005@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Cc: arch@FreeBSD.org, Robert Watson Subject: Re: Simple #define for cache line size X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 11 Apr 2009 21:10:05 -0000 On Sat, 11 Apr 2009, Jason Evans wrote: > Robert Watson wrote: >> Index: arm/include/param.h >> =================================================================== >> --- arm/include/param.h (revision 190941) >> +++ arm/include/param.h (working copy) >> @@ -81,6 +81,10 @@ >> #define ALIGNBYTES _ALIGNBYTES >> #define ALIGN(p) _ALIGN(p) >> >> +#ifndef CACHE_LINE_SIZE >> +#define CACHE_LINE_SIZE 64 >> +#endif >> + >> #define PAGE_SHIFT 12 >> #define PAGE_SIZE (1 << PAGE_SHIFT) /* Page size */ >> #define PAGE_MASK (PAGE_SIZE - 1) >> Index: powerpc/include/param.h > > It would be helpful to instead do: > > #ifndef CACHE_LINE_SHIFT > #define CACHE_LINE_SHIFT 6 > #endif > #define CACHE_LINE_SIZE (1 << CACHE_LINE_SHIFT) > > In particular, src/lib/libc/stdlib/malloc.c would benefit. It shouldn't be ifdefed, since it isn't an option and any override of the definition would tend to give binary incompatibilities, especially if it is used in userland (userland can't match kernel options or know if they are matched). FreeBSD already has too many non-options like this. CACHE_LINE_* is mainly advisory but would still cause binary incompatibilities when it is used for array sizes. Bruce