Received: by 2002:ab2:1c04:0:b0:1f7:53ba:1ebe with SMTP id f4csp47437lqg; Fri, 26 Apr 2024 08:24:19 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVjCHOwDg7Ogle7UwN+BqLumut+6fH4OeQUXhEUe8itFWRgdNoh0nmihGxMlEU5uFL1KGzhx2Mt7e3gmishiLGd6gP+jdWYKBrWz+JI9Q== X-Google-Smtp-Source: AGHT+IHZWYiW1Yjfoj4ZNUrWR8EFdRsdEXMihwQchVH5NIfmuZBxelP9JX8QQZDMk+4rwWMeXYPq X-Received: by 2002:ac8:5901:0:b0:43a:712a:bb97 with SMTP id 1-20020ac85901000000b0043a712abb97mr2646862qty.7.1714145059634; Fri, 26 Apr 2024 08:24:19 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714145059; cv=pass; d=google.com; s=arc-20160816; b=Ab4qcaEpDqHCkuu3Idxs3WYOym4+YjTIQ8M+1O0B2MR0eVHxjf2AythzkwJCRdi8TD ne2Hc/G1Ipt/thmQc3xG2BRcR+dMQH4ezPh4iRhXSraFSZQ6sjo19t2otFlvPU9Lz2J4 JEpgwK4w4NuecbKYJxFWC2UfrXZ717pZ0eijkuyKKf6GSUb3AHJlP8i2LsPn/wr1n/Q4 GtWo1aywXzIefMHVatmfrQU9RV4aPU7GKAg+8bVeqtfnxZARnHNiALqkat1ZK0hOBZtc 7bkxY+o/nQkCWSiO+RmfJs2OtOoPNrQK0KTihz6Rg6vBq6vKBh8SDaQjT1s7H4RQmRme zM4g== 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=XMvpIE0JgEXfII1JTyN/doxgX7dq3PBBUDHJsZLp1kI=; fh=g93rRmaLAWWx/uKAnwYpG6sTmhCbGDR0Bmu+JsWPoLA=; b=g17mxb1OlklFJ8J147rrQBYybEHsIJm0/e11TJJqpq/1RQV28cL6xJsIcwOcrHYcQG WyINkNY2u32HjFhRxwUS2XYt13zWKwrGGfrPup3zyi/K5P+Att0W3NcuwNnqtianl+fn Rfk8fMoSq4ReElLGgAmDdPXQGeVZp5WZjoXOHG9D6uZ8jYAOlBGHWYX2G9LCcp3fGkEg ddgnXHZYJpeJJ7PWLKafOuDXIdIeF4eplb16PQ4OlQZ/KStlRgeFGB/Cc4q4PXTHHm/N vAaZ2FSmboxZjTcHoxHDQxHPOXZKLddODNpR6m84NmLWJFo6bar5i/FHiImTwKvwK4RP a+Xg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EiLP9smO; 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-160275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160275-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id d15-20020ac85d8f000000b004399a0d5844si13344505qtx.444.2024.04.26.08.24.19 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:24:19 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-160275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=EiLP9smO; 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-160275-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-160275-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 1A2091C20B98 for ; Fri, 26 Apr 2024 15:24:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1917D16C44D; Fri, 26 Apr 2024 15:20:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="EiLP9smO" Received: from mail-pl1-f178.google.com (mail-pl1-f178.google.com [209.85.214.178]) (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 A49781607A2; Fri, 26 Apr 2024 15:20:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.178 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144820; cv=none; b=LrYGsUO7QSE58JUauuudCovqPZAeRr4D+fqnG+wNNXdsYbSyKwCb+LyPD5tnPRZEoocrcBHwafFmIHgx+UZsFrPAnDXHfbdejVXw1/Uoqe6p8YccZxuI2Fc/wYtuihgrefp0ltVLm3xAtM+qHpqlgO9vefg5JxqGculibMbfDGk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714144820; c=relaxed/simple; bh=3zKkRul2jH0sxWqgWVvdE95FmZ1KCe46FuAYXSNuAiY=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=UqzRJyrcWUlrXy+A7AzaDhzqylJZ1kfWdXgjcKViLVW9/PohRd0ClO7vZwYdQ5JfQQrp0exWdddNh+IY802/J76J3RkYA5kZe3SP5UV2d+bXzvAUSt7UkfgCDiswv/8i7ZIflGQT9fGkAkBxGbTm3KSJfHAEQsH48UmxlrUMUO4= 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=EiLP9smO; arc=none smtp.client-ip=209.85.214.178 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-pl1-f178.google.com with SMTP id d9443c01a7336-1ead2c5f3f0so1208555ad.0; Fri, 26 Apr 2024 08:20:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714144817; x=1714749617; 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=XMvpIE0JgEXfII1JTyN/doxgX7dq3PBBUDHJsZLp1kI=; b=EiLP9smOrgB20A8sJuj8a8+8SOEhKxLlYVuRC3hKmmyp/gvlo+Cl0tNS+bnUIgogRJ iCHAv05pKZbVN4nr7Th75pNeNJmVtZFWUe8eZdS/Hk+fsy1isMQIHubKW4O5NlfI5B6N TVGg9lWv3NOXyy13WqdefkQ40Ytpo2zQCxhSGWJ2OPWcv3sFOhonEWjWVLBtpCx/V1/M X9eLSM6tNcdut1gwXOvu9LlpS73Qprm9yJRg3EE9Ky03r5hNa3DyToFq4Ls5HVkqvTQF COeDrltq25jqZmyU4bHdtOHG6mCcpUDtNst+EDqf0gJzw1WYXsp0JxHGKrQVilQbN1Sr nNhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714144817; x=1714749617; 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=XMvpIE0JgEXfII1JTyN/doxgX7dq3PBBUDHJsZLp1kI=; b=Qz9i2DZ59XnAj8nIvQAkfTij+LlGaxq4vuLpuixAz/YMdDwaKvLPl8Y4GHA0dGvz0L EizCRkdJ5IL2JYZWm1gSmhdljBz1gYFs3CVxclMVmL6qJa+aBEZZdzruO1YM5fhG+KfL POgdQKbAhkNhs+JNctaVDFARTIcObGNDC3hQjAiRiUjQeVhaLKc9FMHGvw2WsF6RiCk2 XqdLfwxWKUH46u4bUOsKY4xDp+zy6n4rvFRczDISacOS7mRo3olNhX6IkvBfR+UAdFqc +k2zfhgS+7Hj9tQ2X9Ay8OITlMlMc9zJ4kA6pOTPJx7ICO0BtqqGYq8thREJWFNwU7ZN BLvg== X-Forwarded-Encrypted: i=1; AJvYcCV7KmILSlFtGYGmOOPDcWxHnCdINQHXguNTYAZLgRo2A/m3tUK8Hae/VfhC2UO9/BrfeAONZr5sfjby7Us9JhDj/sIPWP3uAqqphdiF7EL6AomRMe4ahiC8a8I5+ECu91nCCaU3hq69774maENh0WoBodcOz3Mje9D+ X-Gm-Message-State: AOJu0YwFLBcQZ3cC8mr3Cr9l6fioeC0RQzcCwhDIwz0veYgIQ5lWZTaU pCao4C5tb0hE4rC6kO8vAoQxRDEYy4zp0o2XJ/5kiIm1+GsIoS02 X-Received: by 2002:a17:902:e747:b0:1e4:397b:492c with SMTP id p7-20020a170902e74700b001e4397b492cmr3232528plf.4.1714144816828; Fri, 26 Apr 2024 08:20:16 -0700 (PDT) Received: from vaxr-BM6660-BM6360.. ([2001:288:7001:2703:751f:9418:61f4:229e]) by smtp.gmail.com with ESMTPSA id w6-20020a170902e88600b001e4ea358407sm15575142plg.46.2024.04.26.08.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Apr 2024 08:20:16 -0700 (PDT) From: I Hsin Cheng To: edumazet@google.com Cc: davem@davemloft.net, dsahern@kernel.org, kuba@kernel.org, pabeni@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, I Hsin Cheng Subject: [PATCH] tcp_bbr: replace lambda expression with bitwise operation for bit flip Date: Fri, 26 Apr 2024 23:20:11 +0800 Message-Id: <20240426152011.37069-1-richard120310@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 In the origin implementation in function bbr_update_ack_aggregation(), we utilize a lambda expression to flip the bit value of bbr->extra_acked_win_idx. Since the data type of bbr->extra_acked_win_idx is simply a single bit, we are actually trying to perform a bit flip operation, under the fact we can simply perform a bitwise not operation on bbr->extra_acked_win_idx. This way we can elimate the need of possible branches which generate by the lambda function, they could result in branch misses sometimes. Perform a bitwise not operation is more straightforward and wouldn't generate branches. Signed-off-by: I Hsin Cheng --- net/ipv4/tcp_bbr.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/net/ipv4/tcp_bbr.c b/net/ipv4/tcp_bbr.c index 146792cd2..75068ba25 100644 --- a/net/ipv4/tcp_bbr.c +++ b/net/ipv4/tcp_bbr.c @@ -829,8 +829,7 @@ static void bbr_update_ack_aggregation(struct sock *sk, bbr->extra_acked_win_rtts + 1); if (bbr->extra_acked_win_rtts >= bbr_extra_acked_win_rtts) { bbr->extra_acked_win_rtts = 0; - bbr->extra_acked_win_idx = bbr->extra_acked_win_idx ? - 0 : 1; + bbr->extra_acked_win_idx = ~(bbr->extra_acked_win_idx); bbr->extra_acked[bbr->extra_acked_win_idx] = 0; } } -- 2.34.1