Received: by 2002:ab2:1149:0:b0:1f3:1f8c:d0c6 with SMTP id z9csp145536lqz; Fri, 29 Mar 2024 11:15:56 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWIiUfA0IauOBJHDBxDFP/3ghflb/0Cco3K8JznA5uGQSqf/hbrg2vsdGBGCE7JVmVPlTM+cedQKMyLtJojculClWboLFbOHEtIl4BTZA== X-Google-Smtp-Source: AGHT+IFyICdfHtnhg78Tu5wo4BnPX9pCvhxujmPC0Z0UCtODjqu7NSu/qZiguV9QFrq3jhF77duB X-Received: by 2002:a17:907:d89:b0:a4e:4818:901e with SMTP id go9-20020a1709070d8900b00a4e4818901emr34189ejc.37.1711736156610; Fri, 29 Mar 2024 11:15:56 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711736156; cv=pass; d=google.com; s=arc-20160816; b=zVgG5GY1xvGD6M0aIbzi1gSm9DEuE1KruAJygPsNrSYQj9yBy10qKeLPNmEZSndqMW HPVi7wcz0jy9fA/MHwiquOFT/F+6eef7tYLFXi8vIY/vvCBCXwFIyBYhejLN9sJam9mf l660M0qVZiFN0lrEM0XC3Gfgl/J3Qaf/j9Oc9y19bqNJpNgaII4EgMQfovFqlbZJu/Nk J5l2KFgly15Rq38Cf/k02uO4xQ4d/mvgqawu7rpsPWMzL3G6ugpvelkXn3ZBfNVFPAC/ tuGiJKoxRekQo5pbB8+LzIj8B8u29vUgvhFuWvgETnsPZJAF2iKdypJSFip91fjPL35n SopA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=GJ1n1WrpcfiZuAd5K78JZW56w27mzJMFDvMl1ypxNfo=; fh=xkVB86JIPgbm5HXVnk7IsNj6jSTiEhgg/XeSMA1buuw=; b=appg/ontfuzOrH4LLOBrgCyyK9tRK+oHSfrfLdbW7g45qBncvOAEXsZjBYgYgOaXS+ tTgJvWeeh/JyCo+DcFJRXk2nFaJCHthgRtCZcy/zbu75vE6vYbdHaQ2pFBSbN3XxJkNN fSZ0RW4hlH1u8HhXin06HHFhnL2VfJMKddaMksPyqSxC4t2iB0ha9irhEMnvvRHGe3rc 4PwaDo3b0ogrVWfUOwbn/5SCmgsZllBtIx8H1BXpHm3rakZmrzq9RHmOJq+v46xoMfss oesiuYY1WG93O1ywy0tpif3Uso64Vg0kTfwqs8f0bdKWrDFHe6gT9FBtoXQHm7OyDm9v tYhA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=EVHvlatA; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-125274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125274-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=acm.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id jt4-20020a170906ca0400b00a46a8fd1b99si1921699ejb.590.2024.03.29.11.15.56 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Mar 2024 11:15:56 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-125274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@acm.org header.s=mr01 header.b=EVHvlatA; arc=pass (i=1 spf=pass spfdomain=acm.org dkim=pass dkdomain=acm.org dmarc=pass fromdomain=acm.org); spf=pass (google.com: domain of linux-kernel+bounces-125274-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-125274-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=acm.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 589CE1F22F46 for ; Fri, 29 Mar 2024 18:15:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 20424137903; Fri, 29 Mar 2024 18:15:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b="EVHvlatA" Received: from 008.lax.mailroute.net (008.lax.mailroute.net [199.89.1.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C0AC31C0DF8; Fri, 29 Mar 2024 18:15:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=199.89.1.11 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711736147; cv=none; b=DMrddVbHut9ODmv3adBkbfh8DB4x+kY4PXwaUCtJxDwS61H7TXLb0S8FWw/1i8caO2J95315cicyrontXypHb2tklV9G5wE5YoRhY1LM7C63JCxNaXn8361903r72dZOJWWZFX0Z7gdZlRzd7cwZriHC7ulmiZMvxKCCVglUvkA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711736147; c=relaxed/simple; bh=Fl9+3J1/oK8uIQd+22QFYM3vM+ksNaxIpZgRdfXlHss=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=M3wAdddjNyfgxui/q2f27mtQY+y6iP3IT34RHrczVKoZ91P4t0xygicZSa5pFE2mw1kpAmzdTdNblygaulNBUDayyEyXsHNKzYaAeAFM9eAENQGxafMKteJ1/5m1L/v3YT/QU3R53mxjhtI5aC3D+YVe9i2Ta+5fpurjrGKUm3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=acm.org; spf=pass smtp.mailfrom=acm.org; dkim=pass (2048-bit key) header.d=acm.org header.i=@acm.org header.b=EVHvlatA; arc=none smtp.client-ip=199.89.1.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=acm.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=acm.org Received: from localhost (localhost [127.0.0.1]) by 008.lax.mailroute.net (Postfix) with ESMTP id 4V5pVm1Xhhz6Cnk8t; Fri, 29 Mar 2024 18:15:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=acm.org; h= content-transfer-encoding:content-type:content-type:in-reply-to :from:from:content-language:references:subject:subject :user-agent:mime-version:date:date:message-id:received:received; s=mr01; t=1711736142; x=1714328143; bh=GJ1n1WrpcfiZuAd5K78JZW56 w27mzJMFDvMl1ypxNfo=; b=EVHvlatAQ0Onhm0tvAY+Ilus/cLiH5tBciX2URyt jbGm+N21P4uFTFm2zx2mpCV1MGlNoAxwVfQ+dSctIXdxFhz4QgG5KM+Sa2g7X1Vh vVxUwsqSCzPVoL631xc6237Y7na2uz0nQXSBMuohasLAY4rWTqrPW2AB0Jzfc/4R bOZNvmhhj/1rKMrdba66xnOx2fWmACoklmDZigwpUxpg2tZcPMos5Dtehu/5IIwP cJV6KryuCi0OoVYtpN43kH7WsTKsrWEG6rNwTZaYIQi2RlG/s9NC+aIhwSTafgMj qvEbLMykeM9NQ2ToVQfw8R+e9wGscpMu0YIxeHLH/vJ/hQ== X-Virus-Scanned: by MailRoute Received: from 008.lax.mailroute.net ([127.0.0.1]) by localhost (008.lax [127.0.0.1]) (mroute_mailscanner, port 10029) with LMTP id H5vHcGFKJvpK; Fri, 29 Mar 2024 18:15:42 +0000 (UTC) Received: from [192.168.3.219] (c-73-231-117-72.hsd1.ca.comcast.net [73.231.117.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: bvanassche@acm.org) by 008.lax.mailroute.net (Postfix) with ESMTPSA id 4V5pVh58M5z6Cnk8m; Fri, 29 Mar 2024 18:15:40 +0000 (UTC) Message-ID: <848d1259-ff6e-4732-b840-a02a5e5fe2cb@acm.org> Date: Fri, 29 Mar 2024 11:15:38 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] blk-wbt: Speed up integer square root in rwb_arm_timer To: I Hsin Cheng , axboe@kernel.dk Cc: akpm@linux-foundation.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org References: <20240329091245.135216-1-richard120310@gmail.com> Content-Language: en-US From: Bart Van Assche In-Reply-To: <20240329091245.135216-1-richard120310@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 3/29/24 2:12 AM, I Hsin Cheng wrote: > As the result shown, the origin version of integer square root, which is > "int_sqrt" takes 35.37 msec task-clock, 1,2181,3348 cycles, 1,6095,3665 > instructions, 2551,2990 branches and causes 1,0616 branch-misses. > > At the same time, the variant version of integer square root, which is > "int_fastsqrt" takes 33.96 msec task-clock, 1,1645,7487 cyclces, > 5621,0086 instructions, 321,0409 branches and causes 2407 branch-misses. > We can clearly see that "int_fastsqrt" performs faster and better result > so it's indeed a faster invariant of integer square root. I'm not sure that a 4% performance improvement is sufficient to replace the int_sqrt() implementation. Additionally, why to add a second implementation of int_sqrt() instead of replacing the int_sqrt() implementation in lib/math/int_sqrt.c? > The experiments runs on x86_64 GNU/Linux Architecture and the CPU is > Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz. Since int_sqrt() does not use divisions and since int_fastsqrt() uses divisions, can all CPUs supported by the Linux kernel divide numbers as quickly as the CPU mentioned above? Thanks, Bart.