Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S271018AbTGPSVd (ORCPT ); Wed, 16 Jul 2003 14:21:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S271045AbTGPSUY (ORCPT ); Wed, 16 Jul 2003 14:20:24 -0400 Received: from adsl-110-19.38-151.net24.it ([151.38.19.110]:3297 "HELO develer.com") by vger.kernel.org with SMTP id S271050AbTGPSSu (ORCPT ); Wed, 16 Jul 2003 14:18:50 -0400 From: Bernardo Innocenti Organization: Develer S.r.l. To: george anzinger , Andrew Morton Subject: Re: do_div64 generic Date: Wed, 16 Jul 2003 20:33:34 +0200 User-Agent: KMail/1.5.9 Cc: linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk, torvalds@osdl.org References: <3F1360F4.2040602@mvista.com> <20030715150645.4fa11de7.akpm@osdl.org> <3F149747.3090107@mvista.com> In-Reply-To: <3F149747.3090107@mvista.com> MIME-Version: 1.0 Content-Disposition: inline Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <200307162033.34242.bernie@develer.com> Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2383 Lines: 54 On Wednesday 16 July 2003 02:07, george anzinger wrote: > > It is only used in nanosleep(), and then only in the case where the sleep > > terminated early. > > > > If someone is calling nanosleep() so frequently for this to matter, the > > time spent in divide is the least of their problems. Unless you have > > some real-worldish benchmarks to demonstrate otherwise? > > It is also used in the jiffies to timespec and jiffies to timeval code > in timer.h, if memory serves. It's true that it's being used in more places than Andrew initially thought, but a quick scan for jiffies_to_timeval() and jiffies_to_timespec() indicates that it's not being used in any place where performance matters too much. I still consider do_div() a big kludge to workaround extremely poor code generated by GCC. If we allow this, I see no reason for not allowing a very similar kludge which provides even better performance. I agree with Andrew that we've run out of time for breaking things again, so I won't be suggesting to implement a whole new set of 64bit operations and use them all over the kernel. However, the div_long_long_rem() function has been _already_ in use on i386 for some time, therefore the safest fix we can do at this point is adding generic support for all other archs. > > You know what they say about premtur optmstns, and having to propagate > > funky new divide primitives across N architectures is indeed evil. > > Hm. I only want the simple div. 64-bit/32-bit in two 32-bit results. > Is this funky? And the "evil" #ifdef allows archs to not do it. The div_long_long_rem() interface is even somewhat cleaner than do_div() and can be implemented easily on architectures providing a 64/32 -> 32q/32r operation (most 32bit processors do have it). > > Bernardo, can you do the patch please? I would be glad to do it once the discussion has settled, whatever the final decision will be. Just don't make me do it twice, please ;-) -- // Bernardo Innocenti - Develer S.r.l., R&D dept. \X/ http://www.develer.com/ Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html - 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/