Received: by 2002:ab2:1689:0:b0:1f7:5705:b850 with SMTP id d9csp1810182lqa; Mon, 29 Apr 2024 22:49:32 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXf6CLbGucQfbSOC4T2FVHmYwj0dE+aJzX4C6Yj8OL22gwabMlVscEAJ6BHs4JZR41NPwJvLOp/V8HJijZ1Cg7SdkVtw2uN3vyaEnTpBw== X-Google-Smtp-Source: AGHT+IGdWUh6wQtNhHS5YfwdOdS4KYXvouoqB19sRWXZKdrqPqD1EZ+q+0Ekepg59ssN4Me/o8+9 X-Received: by 2002:aca:f0d:0:b0:3c8:43b8:f49a with SMTP id 13-20020aca0f0d000000b003c843b8f49amr12838467oip.56.1714456172410; Mon, 29 Apr 2024 22:49:32 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714456172; cv=pass; d=google.com; s=arc-20160816; b=kLJWb3gaFcrUsUZ9cf4dZLeLoMOopksPFEljBAi8iujCi/d8gb4sJGT5bTxUZGpuyh TfawGdDMjxp7WWbXKmowoVE5CBMIIsvrfKhTXnmUIcFA52Fwl9Vw0DjWfgCMDa82l8Am l3nBaiYLxpOMJdaBwqAhvwTRjG+3ZKg5YZhIiZb4NInVrQBvTdSJsl4fA98LDm0lsG13 e6sY1AlKY8G/41vTIEjEGQY9QktayyAGZaGkmpslfLid6N50hzU/bAX1EquJFztUPmkc cPaBeY2+EaQiErTmW12KYdJhI1juXm+Eiguz3Nhp49bAt74k+zBS55113S4VxJEW0J5h tkgw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=Dpy361oIB3q72pLwZ2bKiieKmkru5Dup93g/6xzldv0=; fh=fAYWF4b5l2onxZQBlNI34/e4tHfWuT5ld1uyYJeC6NM=; b=LMjQBcnHnWPts7pE26ZF/buOdm70SCv9QHo6YARSKmSwq4KbG3D4KuRp6083YCSrP0 vZk6tELM1JgjcKplmzFGzOgw5TDaxm5PW38sptmUqhlbhqNmRHZ1k2IN5pBHp+iIgbqU PwWeaKpzxmH8WOKYk69m3eczyQJBO5hQA3ikPqy8OHEoDx2Oiqvt5tUaELp1jbJpMSu/ Ex830S6ORRXtfheCLvHgHJcyOfv1dWEP4jNdu8h/n03CPlOAku99M6VzNae2qgj3TZdY n20821SyJ+F8xRsShDpi60ZBxKQCEuvPwvpxzsDxGjQq3rlSNdZKfiDHGn7loICtN1hm mvKg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lMQwkc9m; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z12-20020a056a001d8c00b006eabb46c931si21316187pfw.8.2024.04.29.22.49.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:49:32 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-163371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=lMQwkc9m; arc=pass (i=1 spf=pass spfdomain=gmail.com dkim=pass dkdomain=gmail.com dmarc=pass fromdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-163371-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-163371-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id E38A6B21DC8 for ; Tue, 30 Apr 2024 05:49:28 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D712317731; Tue, 30 Apr 2024 05:49:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="lMQwkc9m" Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD03917582 for ; Tue, 30 Apr 2024 05:49:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714456160; cv=none; b=TwaRkJolah9KDPPrd9FVLURWumTtYPmv0vUKbjqgB2zO+vHBXClz0mRMaPIUnREKfSeHn1eq/5Z8JKkff0XWSkGg5PmK3mjJ6w6UfxMYjKJZ89R+4lObfv9fsi5O3syVzKiN4GVBv7n/6O9rUhH2+JGNr5Hf0LPLGMWhxjkPmJA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714456160; c=relaxed/simple; bh=PKavDLHA7akrSiYv3ddEc5JsYq3c/1MGnBbU+XVGTK0=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=YOROElmOHVt68SNImjwschS+pB4pSNpTGqg+31W1MYOlitDCOcMvQTWrLVQqPmtCXbzvZlFI4Raizqc9H2DqwhkxTP0ZHNeTtofaqDxYffYW41R9V4RJhWW4yF1PAV+cfmsqU1xXoW+3RgpESBPe9Lqcc8YTTSEtxhlyWvU1lyc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=lMQwkc9m; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2af37c18c10so1286387a91.2 for ; Mon, 29 Apr 2024 22:49:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714456158; x=1715060958; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Dpy361oIB3q72pLwZ2bKiieKmkru5Dup93g/6xzldv0=; b=lMQwkc9mgF56kMCo3ZR26n6TEbpPf/ZJiZCDB7QGn2VAmM+JxPW9HX7w/DZE1Lxi/o m+WbPsBU/HO86u1/gIs5kY0sry+uWaurDXxSbWAw5Tb3FC37Z0AYCB7T2KGKI593kPqE ObdF1S7jKQb6gvlibUEmh/ou6ifU9Y0YnZhFASp5V2Wh3lLoGikrTK1GpYudddig6JcU nstj/hfnJG1i9chTYtd4rTyAf4Vc05WTc2COVbJuEFqhRglTAxgY+Yx6PfUr4lCsmcGT iG5IW3Fh8tiPpCJuWb7EcuyNqozX4TlBsqa62ISHv6F1IMijapZzu9BM3tZVsUtve5qU DZ1w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714456158; x=1715060958; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=Dpy361oIB3q72pLwZ2bKiieKmkru5Dup93g/6xzldv0=; b=aNPKt0j2qS2LtX/OxCyuhNOYkp2rxbuk98i1MqPcSkdwMXDPRuwLj2GDp2g3VVzo+2 bnKPpuPZVflbJIsl9zeW9R4Fyuef0rZSZgamk86lJ9zs2u/VD8gwFyj5vad184BGnwC3 5OVC2vhMF3UTNvZazmYdmmuxpPukh10HVaK2sJYhA1Kz/qfhyai8kiuLy0ba+aNAfZfR sR/6Tl2VNsJC65w02peYAWA76W83nwcaGX096G9gIDKeIYDJ5ah6W096Q9nsIMILaa2D Q+ofDQ/oqX4WHzYqQwTQMSSmsMxW7TydFtQPbaYUY6BhtNqMtBcxtle26IMKw/M1xztZ c0DA== X-Forwarded-Encrypted: i=1; AJvYcCXDBamZRdiFJ0pljJo5KN6ScLtXQPZbzyIFGvt0k2QwToJ9bGWqOWnyR0X73e9PfiyOB97PuOkM0ntFNw+DNDPnb3LMHAG/CHv6YzZN X-Gm-Message-State: AOJu0YxhwHYsz14KJywAXuVkRowHeGu21kMeGQNjfO5mOuYUlAFSLRhV iSrLg8IzF+sWHzLrMDx1UX+nMDQDzw2AEyNA5WEPe3hQIaFuHScS X-Received: by 2002:a05:6a21:7894:b0:1ae:4145:a250 with SMTP id bf20-20020a056a21789400b001ae4145a250mr14891313pzc.3.1714456158066; Mon, 29 Apr 2024 22:49:18 -0700 (PDT) Received: from visitorckw-System-Product-Name.. ([140.113.216.168]) by smtp.gmail.com with ESMTPSA id u12-20020a17090adb4c00b0029df9355e79sm20471652pjx.13.2024.04.29.22.49.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 22:49:17 -0700 (PDT) From: Kuan-Wei Chiu To: akpm@linux-foundation.org, yury.norov@gmail.com Cc: linux@rasmusvillemoes.dk, linux-kernel@vger.kernel.org, Kuan-Wei Chiu Subject: [PATCH v2 0/2] bitops: Optimize fns() for improved performance Date: Tue, 30 Apr 2024 13:49:10 +0800 Message-Id: <20240430054912.124237-1-visitorckw@gmail.com> X-Mailer: git-send-email 2.34.1 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hello, This patch series optimizes the fns() function by avoiding repeated calls to __ffs(). Additionally, tests for fns() have been added in lib/find_bit_benchmark.c. Changes in v2: - Add benchmark test for fns() in lib/find_bit_benchmark.c. - Change the loop in fns() by counting down from n to 0. - Add find_bit benchmark result for find_nth_bit in commit message. Link to v1: https://lkml.kernel.org/20240406235532.613696-1-visitorckw@gmail.com Kuan-Wei Chiu (2): lib/find_bit_benchmark: Add benchmark test for fns() bitops: Optimize fns() for improved performance include/linux/bitops.h | 12 +++--------- lib/find_bit_benchmark.c | 25 +++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 9 deletions(-) -- 2.34.1