From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4617BC433E0 for ; Fri, 26 Feb 2021 21:04:28 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA37564F0D for ; Fri, 26 Feb 2021 21:04:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230260AbhBZVEH (ORCPT ); Fri, 26 Feb 2021 16:04:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230019AbhBZVD7 (ORCPT ); Fri, 26 Feb 2021 16:03:59 -0500 Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 65ED6C061574 for ; Fri, 26 Feb 2021 13:03:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=HPJI91stzZA9wEpS+5JwU+qgZlLkubQ/U0goZvbUUrw=; b=lFTvyeVPHx0qbjZm/qudFzU6u+ KrWywt+hU+EeU2ZBmwbTSoaBefucMMGAEsqTZdKY4pZZIS+cuSCMN/8SzeJULgtfQ52DU4vIFTjAQ 04lMQL51eEe5rLBQGGYLs5n0mr5jNLRhmDyTKWuO9sKyrqMSoUuy9B803tDoi/7+E92X4ARS4k9Em HSjVs1YMBHY3NjpxoULjYvVozGZ3eU6P/Za33YQAKbeam2FfT6lSPUoEOHfkL8VAV8u3rsXovlnTy XXs/5BnuTlOR6uX90N0Iw0x1zq/nD9DIIDnWUxaVTSGj1OtFdXRiHw60luhLrx5gWaXBQz8+0eOS1 bgbUpxcQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92.3 #3 (Red Hat Linux)) id 1lFkGQ-0007B7-SN; Fri, 26 Feb 2021 21:03:07 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 4FF7A300DB4; Fri, 26 Feb 2021 22:03:04 +0100 (CET) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 127BE2065B4A4; Fri, 26 Feb 2021 22:03:04 +0100 (CET) Date: Fri, 26 Feb 2021 22:03:04 +0100 From: Peter Zijlstra To: Josh Don Cc: Ingo Molnar , Juri Lelli , Vincent Guittot , Dietmar Eggemann , Steven Rostedt , Ben Segall , Mel Gorman , Daniel Bristot de Oliveira , linux-kernel@vger.kernel.org, Clement Courbet , Oleg Rombakh Subject: Re: [PATCH] sched: Optimize __calc_delta. Message-ID: References: <20210226195239.3905966-1-joshdon@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210226195239.3905966-1-joshdon@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 26, 2021 at 11:52:39AM -0800, Josh Don wrote: > From: Clement Courbet > > A significant portion of __calc_delta time is spent in the loop > shifting a u64 by 32 bits. Use a __builtin_clz instead of iterating. > > This is ~7x faster on benchmarks. Have you tried on hardware without such fancy instructions?