From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 7 23:57:24 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 644E61065670 for ; Sat, 7 Aug 2010 23:57:24 +0000 (UTC) (envelope-from ivoras@gmail.com) Received: from mail-qw0-f54.google.com (mail-qw0-f54.google.com [209.85.216.54]) by mx1.freebsd.org (Postfix) with ESMTP id 10C088FC08 for ; Sat, 7 Aug 2010 23:57:23 +0000 (UTC) Received: by qwg5 with SMTP id 5so4970480qwg.13 for ; Sat, 07 Aug 2010 16:57:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:mime-version:sender:received :in-reply-to:references:from:date:x-google-sender-auth:message-id :subject:to:cc:content-type:content-transfer-encoding; bh=MMeNRz5MvvAuy733UHDSxBNpJnmLPNbRa1zb/Gppa08=; b=dGnmPradG+55Mj2/Rc2vFsf5+FnvDUEUc+tHtCfPKOYZMa19Ufa4q22epnSgmNHut4 ma1jcwL8uotoeuAU/jgHBj2AZrstbaZrL5LuU9RkTn9Fgkhnu1fW0ouWF0cmqjFu2+hG dxCYb5TwJ4aG8n55C4KcEi78ZdprfGoxWqjQU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:from:date :x-google-sender-auth:message-id:subject:to:cc:content-type :content-transfer-encoding; b=UYiuEYSgiww3u1AozwQlBGBRPiwHr4tNU7enu5FzFzpMWGCYP5X1QyrFskwZoSAJtT 4o7pmllt6r8JNTYrxan3xTTyuWviERrT9tD76rXssS22dKcsz1QLrI093guhJQjv4zz6 qX8TER67XTMPv4piuGAC1mVA3tvlcjR4ydFRg= Received: by 10.229.222.65 with SMTP id if1mr6047998qcb.31.1281223839175; Sat, 07 Aug 2010 16:30:39 -0700 (PDT) MIME-Version: 1.0 Sender: ivoras@gmail.com Received: by 10.229.236.132 with HTTP; Sat, 7 Aug 2010 16:30:19 -0700 (PDT) In-Reply-To: <864of680wv.fsf@ds4.des.no> References: <86fwyq8rsc.fsf@ds4.des.no> <86d3tujh72.fsf@ds4.des.no> <864of680wv.fsf@ds4.des.no> From: Ivan Voras Date: Sun, 8 Aug 2010 01:30:19 +0200 X-Google-Sender-Auth: phyiFOCeRN8Ayq3jn8nCKlwBmvU Message-ID: To: =?UTF-8?Q?Dag=2DErling_Sm=C3=B8rgrav?= Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Cc: freebsd-hackers@freebsd.org, Garrett Cooper Subject: Re: Why is TUNABLE_INT discouraged? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Aug 2010 23:57:24 -0000 2010/8/8 Dag-Erling Sm=C3=B8rgrav : > Garrett Cooper writes: >> Dag-Erling Sm=C3=B8rgrav writes: >> > Perhaps. =C2=A0I don't remember all the details; I can't find a discus= sion in >> > the list archives (other than me announcing the change in response to = a >> > bug report), but there must have been one, either on IRC or in Karlsru= he. >> > In any case, I never removed TUNABLE_INT(), so... >> It does matter for integers on 64-bit vs 32-bit architectures though, >> right > > Not sure what you mean. =C2=A0The original issue was that someone had use= d > TUNABLE_INT() for something that was actually a memory address. =C2=A0I > changed it to TUNABLE_ULONG(). =C2=A0Of course, if your tunable is a bool= ean > value or something like maxprocs, an int is fine - but so is a long. Semantically valid but using TUNABLE_INT to hold pointers is a developer bug, not the fault of the API, and there's nothing wrong with "int" as a data type in this context. Unless there is a real hidden danger in using TUNABLE_INT (and/or adding TUNABLE_UINT etc.) in the expected way, I'd vote for either removing the cautioning comment or rewriting it to say something like "developers are hereby warned that ints cannot hold pointers on all architectures", if it is indeed such a little known fact among kernel developers :P