From owner-freebsd-hackers@FreeBSD.ORG Mon May 5 20:44:23 2008 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 C995D1065672 for ; Mon, 5 May 2008 20:44:23 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from vlakno.cz (vlk.vlakno.cz [62.168.28.247]) by mx1.freebsd.org (Postfix) with ESMTP id 890338FC17 for ; Mon, 5 May 2008 20:44:22 +0000 (UTC) (envelope-from rdivacky@vlk.vlakno.cz) Received: from localhost (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id 94E8167E345 for ; Mon, 5 May 2008 22:43:51 +0200 (CEST) X-Virus-Scanned: amavisd-new at vlakno.cz Received: from vlakno.cz ([127.0.0.1]) by localhost (vlk.vlakno.cz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fy9SWxs6lU6m for ; Mon, 5 May 2008 22:43:50 +0200 (CEST) Received: from vlk.vlakno.cz (localhost [127.0.0.1]) by vlakno.cz (Postfix) with ESMTP id A43F2673CE1 for ; Mon, 5 May 2008 22:43:50 +0200 (CEST) Received: (from rdivacky@localhost) by vlk.vlakno.cz (8.14.2/8.14.2/Submit) id m45KhoPq045880 for hackers@freebsd.org; Mon, 5 May 2008 22:43:50 +0200 (CEST) (envelope-from rdivacky) Date: Mon, 5 May 2008 22:43:50 +0200 From: Roman Divacky To: hackers@freebsd.org Message-ID: <20080505204350.GA45321@freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i Cc: Subject: hashinit versus phashinit 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: Mon, 05 May 2008 20:44:23 -0000 hi when we want to use a hash table in kernel we call "hashinit" which initializes a hash table with power-of-2 size. There's also "phashinit" that creates hash table of size that is a prime number. This was added in 1995 by davidg@ but it is not used anywhere in the kernel. phk@ commited rev. 1.30 of vfs_cache.c replacing phashinit with hashinit stating that it's better because it replaces a division with logical and. is this reason still valid today? (the commit was done almost 11 years ago) is there still any reason why not use the phashinit instead of hashinit? I believe using prime-sized hash table might have positive performance impact... do you have comments? roman