From nobody Sat Sep 28 21:26:51 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4XGL4r12X0z5XsMZ; Sat, 28 Sep 2024 21:26:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4XGL4q5Jvtz40xZ; Sat, 28 Sep 2024 21:26:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727558811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oh7fs6tXbiuJ1dDAJifB+h/jye2B2fQaF43ZasL6/co=; b=m1q0iI2NS1ad67OlTuiYqzZ0qp1OAx1T0hbVB8OsQVigm8MFFAKLZZ4vsnRsL2xl0kdrun 1Frzkb7vYflWmOdUghyA6BdCwC/rRSVhqD638E/P2B7QNncj3sNTp7Cchv/Ogj7ElM2fhU InecwugG/pRxD+YFrjcbQe/1FM+JtbLp08GqiBYLCYyCCibqSqlfFV0ZruOmq5t7d9nOr1 VUFd4B9LqMEJT9HKx+UAgLc0JOaqM0XQRACAiNA+WjATcSrmyfX3Socs+v0K4o2TNcfwax QKEv8ihvkXNOqGSuSPq8MjBTJGN3OIhWiSKjDHSUog55sdQmATdX37/WqicApw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1727558811; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=Oh7fs6tXbiuJ1dDAJifB+h/jye2B2fQaF43ZasL6/co=; b=gdzJz4R7avZUOLF16gPawWangkSLowcOiwSlLGjQEG97nhKSkRe9FLOBvktO8o11WThkRH bpap/Z8vsllU0EgEhDFRI2mKpxpWpn0nQPg7IrjFeE1dP3+i5zSX9JtvZ/8IUQ++IId/Pc T5mM+QtRY6/VwtujemdUIdpYWdlxK8wQbDzR/ukFt2Wqzm7SMjO1jTkXgfS5ixYD6EphbJ btM0FzMtCevQwlZ7War8FIU8qMLieRFSKts7w4u+YDYB1N7eIUjz9j2UjHfK6BMz3Yj/oD 9l2/F2kGkMwB0a0zT+2sO18S6Vl2CfwzGwWKgjpRPrxoVe5rRxEocYfXoMapZw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1727558811; a=rsa-sha256; cv=none; b=GN5lmu0z6OLW2wk8vPPj3AqXwrIN6MYHH8pUlnGhHyQfgb8IFw7P3yWqYwehuNqc1ExKaj yqEHRAnkR+nzXQ7AVC0g90AbTmmuvbiBBmUS348vYjIQm0nMsXcvLD4hEgdhX2Yiexz/Bk WeEYCLHXNchzkry58SsNJrtN1XzUf3fOKzhHXkJJ5a3e1CR0cO7yMfsTo+rcCni/dkZSgs 02FdgSPlZQNOfiKBdP4yDyGpNRdkuIvFY0gYT17Z7j/v7kU30HelrdNkfbJfsSb2RsADjg 9e8NfR9wDi1qfg4fQ1VXqyeKuCiF0qi8vhTRB+OJhlBrYlpjNxG3WGFiYKeRKA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4XGL4q4g9Hzh7b; Sat, 28 Sep 2024 21:26:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 48SLQpkQ000636; Sat, 28 Sep 2024 21:26:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48SLQpMd000633; Sat, 28 Sep 2024 21:26:51 GMT (envelope-from git) Date: Sat, 28 Sep 2024 21:26:51 GMT Message-Id: <202409282126.48SLQpMd000633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Doug Moore Subject: git: 5a5da24fc85a - main - mlx5: optimize ilog2 calculation List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dougm X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5a5da24fc85aa7711eed8f3e303c0cf6f5ebcca4 Auto-Submitted: auto-generated The branch main has been updated by dougm: URL: https://cgit.FreeBSD.org/src/commit/?id=5a5da24fc85aa7711eed8f3e303c0cf6f5ebcca4 commit 5a5da24fc85aa7711eed8f3e303c0cf6f5ebcca4 Author: Doug Moore AuthorDate: 2024-09-28 21:24:44 +0000 Commit: Doug Moore CommitDate: 2024-09-28 21:24:44 +0000 mlx5: optimize ilog2 calculation Rather than compute ilog2(roundup_pow_of_two(x)), which invokes ilog2 twice, just use order_base_2 once. And employ that optimization twice. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D46838 --- sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c index bd06e531531b..9428e6ece3a4 100644 --- a/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c +++ b/sys/dev/mlx5/mlx5_ib/mlx5_ib_mem.c @@ -78,10 +78,10 @@ void mlx5_ib_cont_pages(struct ib_umem *umem, u64 addr, } if (i) { - m = min_t(unsigned long, ilog2(roundup_pow_of_two(i)), m); + m = min_t(unsigned long, order_base_2(i), m); if (order) - *order = ilog2(roundup_pow_of_two(i) >> m); + *order = order_base_2(i) - m; *ncont = DIV_ROUND_UP(i, (1 << m)); } else {