From owner-freebsd-hackers@FreeBSD.ORG Sun Aug 8 09:31:46 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 55F0A1065670; Sun, 8 Aug 2010 09:31:46 +0000 (UTC) (envelope-from yanegomi@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 0368A8FC08; Sun, 8 Aug 2010 09:31:45 +0000 (UTC) Received: by iwn10 with SMTP id 10so3559613iwn.13 for ; Sun, 08 Aug 2010 02:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=Ylt6AJKNiVwM8tsGsK2Ti+TqgeamEbK5T8kPSooDH7A=; b=u45Zteh3N6I5vsau6bJDSb/+eLu4x3ctDV89SfMVeILnmwkiEF0WSEpCy04l7gJvrQ /W2+CKgXNffcf82BkBslzRrj+piXoewtPHfsgP5TO12EI/qznj5lKGRo5QyQXS8PeAWB ux5YMk1tgPxFdB3EjLn32Ca9N93wgTsabuXjc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=G3wdy4R+c/A6/ik2pN80imvY/5GVHTRaYAKx3ne24iS1bO80c8TcdWuW4PN1ft7Z9z 5Ew7x+C8JdB1lFyvGzQEkCK2NAOSah8ZbMqWh74oJuaTMwEhvswaWHmv5241SEpF7mM3 9nnDXULmXJR8axqeKLbVzXX4ZbSB3F823IIkQ= MIME-Version: 1.0 Received: by 10.231.17.1 with SMTP id q1mr5078154iba.17.1281259904995; Sun, 08 Aug 2010 02:31:44 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.173.133 with HTTP; Sun, 8 Aug 2010 02:31:44 -0700 (PDT) In-Reply-To: References: <86fwyq8rsc.fsf@ds4.des.no> <86d3tujh72.fsf@ds4.des.no> <864of680wv.fsf@ds4.des.no> Date: Sun, 8 Aug 2010 02:31:44 -0700 X-Google-Sender-Auth: hvrCItECn4QhssyutzzY9fx7_oY Message-ID: From: Garrett Cooper To: Ivan Voras Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: =?ISO-8859-1?Q?Dag=2DErling_Sm=F8rgrav?= , freebsd-hackers@freebsd.org 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: Sun, 08 Aug 2010 09:31:46 -0000 2010/8/7 Ivan Voras : > 2010/8/8 Dag-Erling Sm=F8rgrav : >> Garrett Cooper writes: >>> Dag-Erling Sm=F8rgrav writes: >>> > Perhaps. =A0I don't remember all the details; I can't find a discussi= on 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 Karlsr= uhe. >>> > 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. =A0The original issue was that someone had used >> TUNABLE_INT() for something that was actually a memory address. =A0I >> changed it to TUNABLE_ULONG(). =A0Of course, if your tunable is a boolea= n >> value or something like maxprocs, an int is fine - but so is a long. Why would someone express a tunable in a memory address (not being sarcastic... I just don't see why it makes sense right now, but if there's a valid reason I'm more than happy to be educated :)..)? > 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 *grins cheekily in agreement* :). Thanks, -Garrett