Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1524818pxb; Fri, 26 Feb 2021 13:06:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJz4n16Bw0tVjtgpEyip0eY+5DXGuPdUQQHqYVkOlK788LkdwOWU+4iw7OdtUNwzGFJz4Bof X-Received: by 2002:a17:906:b0d8:: with SMTP id bk24mr5483693ejb.252.1614373615877; Fri, 26 Feb 2021 13:06:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614373615; cv=none; d=google.com; s=arc-20160816; b=VfBrp9B3PJGAfQ4vD2CxvwCzuEsmxXWucWCohYVqo/okNs6+gS4IaXTA9UcG9rURIP oXtwWrqg25PygJdNhtMabNW9Wm+RqPkufqXEEE5m+ODFg2V/8SxbsgxQTs4ZyslMCLQ/ uMlNWkOcrCPISSEfdh+6TeBO6XUun3QR9ur5yhr+NbRNWiTdnDqMzCy1n+GznX0Xek6v VR7XoCYFcfjw394B1Q4DbgIHVXMH++7XXBA3F4tzXfcwQSL4S5z4Ba/d9dH8oIklsbLY +vvZzOWT2ARieN3XUbO9nIxRX1HyuxY4S81A9oLvn2Quz1fC3F8mfzQY9JLB2WK1gpBI y/Ew== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=HPJI91stzZA9wEpS+5JwU+qgZlLkubQ/U0goZvbUUrw=; b=zveU4kd7eVYlkJ2ByAL6XLdlWa2/ZQA5DYDWV7oXlrGcQarf8Aa5Tgu0X337OrNnk7 G+/hTjfezG47o+uOkEjdiIqqFhS/pwUGN7oEptuaoa7U30UvXrKKkeOWioQBlgiloLQx r8K5sM1VXItjx4tJruHohXJ0Lbi6iUy8dOn8wuQIaUg0PfUVkGaelSDaFTTLZShpE3Qp RmVPl2KqO+gcCOPCgh/1YHvyhikzbA0/GMgClbtkfYCSVwnRw0+lzJZ9Sw+2o2IyhWPb wa4jXLOJMFg6CnGEKygENWMBqsPK7a+d7P++DwdPQ5M+jvgLXJNk6M9v1ov3FgbWdk02 PgNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=lFTvyeVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a89si7067748ede.326.2021.02.26.13.06.33; Fri, 26 Feb 2021 13:06:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=merlin.20170209 header.b=lFTvyeVP; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230083AbhBZVEB (ORCPT + 99 others); Fri, 26 Feb 2021 16:04:01 -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?