Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754434Ab3DMOyt (ORCPT ); Sat, 13 Apr 2013 10:54:49 -0400 Received: from mx1.redhat.com ([209.132.183.28]:3063 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754161Ab3DMOyr (ORCPT ); Sat, 13 Apr 2013 10:54:47 -0400 Date: Sat, 13 Apr 2013 16:55:38 +0200 From: Stanislaw Gruszka To: Linus Torvalds Cc: Peter Zijlstra , Linux Kernel Mailing List , Ingo Molnar , "H. Peter Anvin" , =?iso-8859-1?Q?Fr=E9d=E9ric?= Weisbecker , Steven Rostedt , Andrew Morton , Thomas Gleixner , linux-tip-commits@vger.kernel.org Subject: Re: [tip:sched/core] sched: Lower chances of cputime scaling overflow Message-ID: <20130413145538.GB11556@redhat.com> References: <20130326140147.GB2029@redhat.com> <1365687946.8824.3.camel@laptop> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 726 Lines: 19 On Thu, Apr 11, 2013 at 08:38:37AM -0700, Linus Torvalds wrote: > /* We know one of the values has a bit set in the high 32 bits */ > for (;;) { > /* Make sure "stime" is the bigger of stime/rtime */ > if (rtime > stime) { > u64 tmp = stime; stime = rtime; rtime = tmp; > } For most workloads rtime is bigger than stime, so swapping those would save some cycles on common cases. Otherwise this algorithm looks great. Thanks Stanislaw -- 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/