Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S261196AbVCTNEY (ORCPT ); Sun, 20 Mar 2005 08:04:24 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S261197AbVCTNEY (ORCPT ); Sun, 20 Mar 2005 08:04:24 -0500 Received: from fire.osdl.org ([65.172.181.4]:46010 "EHLO smtp.osdl.org") by vger.kernel.org with ESMTP id S261196AbVCTNEV (ORCPT ); Sun, 20 Mar 2005 08:04:21 -0500 Date: Sun, 20 Mar 2005 05:04:03 -0800 From: Andrew Morton To: Jan Engelhardt Cc: linux-kernel@vger.kernel.org Subject: Re: Short sleep precision Message-Id: <20050320050403.672bf30a.akpm@osdl.org> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.7 (GTK+ 1.2.10; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 783 Lines: 20 Jan Engelhardt wrote: > > I have found that FreeBSD has a very good precision of small sleeps -- Linux nanosleep() used to have a busywait loop for sleeps less than two milliseconds. 2.4.x still does. We thought it was stupid and took it out. > what's holding Linux back from doing the same? Using the code snippet below, > FBSD yields between 2 and 80 us on the average while Linux is at > "constantly" ~100 (with HZ=1000) and ~1000 (HZ=100). > You can spin on the gettimeofday() result in userspace. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/