From owner-freebsd-hackers@FreeBSD.ORG Sat Aug 7 06:48:20 2010 Return-Path: Delivered-To: hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5EBAC1065678 for ; Sat, 7 Aug 2010 06:48:20 +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 1C0FC8FC13 for ; Sat, 7 Aug 2010 06:48:20 +0000 (UTC) Received: by iwn10 with SMTP id 10so2448988iwn.13 for ; Fri, 06 Aug 2010 23:48:19 -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:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=y0jUOEB8pNwF82dzxDOHYejI9JCPxMe+If7ykLTdnBY=; b=oueooFrNypyl8B5IeadZRt/zfIbafXFLFjS5kyf9jR0//OH753beNMUEohZJ1nf7hE RFi0uDyqtQJQ9jdBlADrF9MyXpKKdYaBiuBkXblA0tfBPZbGZUoRLZn08fsIl8pbXzmS GsKS0SkLqXomMdU7v8f+Ynl3M5sSy9qlUdFvE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type; b=v4UXA3RQyciTUyYTrc96X1WA6zUD7J2Y80WRM+Z0u3pT/+6RZF/1ZmlA20mxDI40LZ 43lKatCHTtptT3J5CHBo34DJyXNupHbdqnNudvlWuDc3X71s/+O9XsQvL6JpnpTe2Xwo fV/1M2gBEzHOPTfF07qxMMuep+GzPK4FBFsTs= MIME-Version: 1.0 Received: by 10.231.183.134 with SMTP id cg6mr10244622ibb.197.1281163699615; Fri, 06 Aug 2010 23:48:19 -0700 (PDT) Sender: yanegomi@gmail.com Received: by 10.231.173.133 with HTTP; Fri, 6 Aug 2010 23:48:19 -0700 (PDT) Date: Fri, 6 Aug 2010 23:48:19 -0700 X-Google-Sender-Auth: _Z83BQoqEjkqhVpmzuhhYaFkkSw Message-ID: From: Garrett Cooper To: hackers@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 Cc: des@freebsd.org Subject: 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 06:48:20 -0000 Hi Hackers, Poking around the sound(4) drivers, I looked into converting one of the TUNABLE_INTs to an unsigned tunable for testing purposes. I looked in kernel.h and I saw the following comment: /* * int * please avoid using for new tunables! */ I found the commit where it was made (by des@ -- cvs revision 1.120), but unfortunately I lack the context as to why that suggestion is made; the commit isn't very explicit as to why integers tunables should be discouraged -- and in the case of hw.sound.feeder_rate_round, it makes just as much sense to use an integer type or a long integer type, as accepted input values are small enough to fit in an integer value with a _lot_ of headroom: hw.snd.feeder_rate_round Sample rate rounding threshold, to avoid large prime division at the cost of accuracy. All requested sample rates will be rounded to the nearest threshold value. Possible values range between 0 (disabled) and 500. Default is 25. It would be nice to know why TUNABLE_INT is discouraged :). Thanks! -Garrett