Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp9579917rwd; Wed, 21 Jun 2023 09:06:31 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5nah9YK3j5FT1HAa53iCBi7E4OvVHuOH6lMmyUYaUxpbfu/W8MUYy5WF6PkR1qA7rX8IG6 X-Received: by 2002:a05:6a00:acc:b0:666:7bc5:531c with SMTP id c12-20020a056a000acc00b006667bc5531cmr22733358pfl.24.1687363591133; Wed, 21 Jun 2023 09:06:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687363591; cv=none; d=google.com; s=arc-20160816; b=mzY9RKwGryjo9W0FP/CdxElVTiB4VGP2k+0OqYCHCmKUBUsZBpEhHS9V7XUzY0gR9M T57+g4+lT2wgEBk3dDJLvij6KQjS3OFkrSMEbKoXjd+oYuLIkCo9lVCTdRmV0VmDAbVd Ebi2vm+ApxIBPSXneNL9w03XjFv9ksLpAFilF9dtwzhktGvpBKjRQyesgg+PG8NmYy73 umt/zeesfqgcfxZfl0aff5z4ylgGkcrA/ZhPiIl02T5XCXhtUmgSaowLLwAuluWQJk3g lSDxxetGAhCMi18Rbo5EFzcwJ6Z1cB/+PKcOJVOFPRf19sy/H1F19l6xPP+6aeEm5i8r jFvg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=zbPAeOGrUEIOV+JujOL9INmhyma6JwFI+vqDZGWGqOk=; b=RfNP9bHGpb/P+L2ZEtXq7vtF8b9wuhFKdW1aFNY/DHQfeoOg9D0aQuELQh17e4HDkk QovNZMChgYnLg+MxZZHhaZHvz9D2VI0ScIMEvT3WjNQEc3WMD5MobhsJfIweJ25n2+8Q b0GM1Y6mcTH5tUPhK6a4x1sKzTu67lTn67Sm8u9KJs6lFlTin6e72eoluZWlWUe75hjt EmNE73Wtx1mRs+SEViDUtxBBpYemilSxwdXyA+9yWlafbTDhJDkt+N7AerqYQlq4tYUq 20OB5Rms37V/4NDpY2NzFloQ8kw9unlBS3/5oeiVpwU7+hDAuoajRYwiaaAVNL3okxMK 7nOw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=fop1sEkk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m28-20020a637d5c000000b00544059be66bsi2936863pgn.810.2023.06.21.09.06.19; Wed, 21 Jun 2023 09:06:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=fop1sEkk; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232879AbjFUPHx (ORCPT + 99 others); Wed, 21 Jun 2023 11:07:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232978AbjFUPHc (ORCPT ); Wed, 21 Jun 2023 11:07:32 -0400 Received: from smtp-fw-52004.amazon.com (smtp-fw-52004.amazon.com [52.119.213.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 673934239; Wed, 21 Jun 2023 08:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1687359745; x=1718895745; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=zbPAeOGrUEIOV+JujOL9INmhyma6JwFI+vqDZGWGqOk=; b=fop1sEkk90qtxm8OZfTFpmBI5Q6kymfZtycgyCraGKaaWw9K/9hyrbgo 2dd2Zr5+kIjW+fiVrNDuF48N/eztk0PKMT8Ucj7qseujBHBP7jI5lFKWM ulpXD9rnjwKELepcnj/AN1kzf451o37NV+N/YQXPVTtoWbAycsf6VlC/3 Y=; X-IronPort-AV: E=Sophos;i="6.00,260,1681171200"; d="scan'208";a="138321779" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-pdx-2a-m6i4x-d40ec5a9.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-52004.iad7.amazon.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2023 15:01:15 +0000 Received: from EX19MTAUWC001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-pdx-2a-m6i4x-d40ec5a9.us-west-2.amazon.com (Postfix) with ESMTPS id EC7B840D4E; Wed, 21 Jun 2023 15:01:12 +0000 (UTC) Received: from EX19D004ANA001.ant.amazon.com (10.37.240.138) by EX19MTAUWC001.ant.amazon.com (10.250.64.174) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 21 Jun 2023 15:01:12 +0000 Received: from 88665a182662.ant.amazon.com.com (10.119.169.70) by EX19D004ANA001.ant.amazon.com (10.37.240.138) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.26; Wed, 21 Jun 2023 15:01:07 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH bpf-next v2 3/6] net: remove duplicate reuseport_lookup functions Date: Wed, 21 Jun 2023 08:00:58 -0700 Message-ID: <20230621150058.59250-1-kuniyu@amazon.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8bit X-Originating-IP: [10.119.169.70] X-ClientProxiedBy: EX19D044UWB003.ant.amazon.com (10.13.139.168) To EX19D004ANA001.ant.amazon.com (10.37.240.138) X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,T_SPF_PERMERROR autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lorenz Bauer Date: Wed, 21 Jun 2023 09:01:15 +0100 > On Tue, Jun 20, 2023 at 7:31 PM Kuniyuki Iwashima wrote: > > > > Good point. This is based on an assumption that all SO_REUSEPORT > > sockets have the same score, which is wrong for two corner cases > > if reuseport_has_conns() == true : > > > > 1) SO_INCOMING_CPU is set > > -> selected sk might have +1 score > > > > 2) BPF prog returns ESTABLISHED and/or SO_INCOMING_CPU sk > > -> selected sk will have more than 8 > > > > Using the old score could trigger more lookups depending on the > > order that sockets are created. > > So the result will still be correct, but it's less performant? Happy > to fix a perf regression, but if the result is incorrect this might > need a separate fix? Right, the result is always correct. If BPF prog selects a different socket per lookup, there is no consistency, but it _is_ corret. > I did some more digging. I think this was introduced by commit > efc6b6f6c311 ("udp: Improve load balancing for SO_REUSEPORT.") which > unfortunately ran into a merge conflict. That resulted in Dave Miller > moving the bug around in commit a57066b1a019 ("Merge > git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net"). Can you > take a look and let me know if you think that is correct? Yes, I should have updated the score too in efc6b6f6c311 to save unneeded lookups. The conflict itself was resolved properly.