Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp1286361pxj; Sat, 15 May 2021 09:35:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSOISpJiKFo0cEs9X/TmJu0LyNiL6RETH1CtpxBWJfOFjmXWzICykrOwj6W3LxMeaO5rdj X-Received: by 2002:a17:906:fb88:: with SMTP id lr8mr8865438ejb.429.1621096558674; Sat, 15 May 2021 09:35:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621096558; cv=none; d=google.com; s=arc-20160816; b=Bqe/aGLGt1CW2c9C5gVjAdSx/mLrakeuig3FxMhqXlnNo/8qsiioCGI1TmUO8wUvWP fk6VpUFQgtqcmq+wP3qsiRZoWkl4pnMXfOfDdPrbfb4h72sEwSe6+8W9DHrYBFRYL050 3af8LrnSxdXNvm28ZeP48JLd3+7fLlL1U36VVjNFXNVP/SqCw5cKJ3B2y53bENLX4FbD jGzO6JSqg63gDsHl3pLc8m2HQigTcB31zn1Ty8gzE1J2vLY0rXCwqRFP17QEH1nZwU19 uAJB6u6AWH0vxTlm5kRS9ywdzMWp5ea8ZOqgWR+VCOaLDEK8YtgHbjKq9EcQqfAOFkm6 ItWg== 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=+aZD1zLSq6chFtKoY8/utueoK2N/X9wi5QRRMf7pO34=; b=bAuWVulK9OfOECHDExjTbHBtixhg1Fle9p/q3QgjSpxwwE6rqIukiIkgvjqjpAfwh6 Hr9YHfDgONQM6CY2bSZKrwttDvYoCSEuYrytNo685YpTZJXRz+66QeSVsUJpm+WMgOD4 6pkI6YBBi9cgSMBu0OHFO//n2WsPf/SGR+YyxD7NVT8d+AynG6PVJymETRsvms8xyl75 gjJd737L7ptQMWAKjQusc2fHwJE/fd8qGbADgWrJgaMFtkM9KPj/7GUQVBzmL7J8Ws4i KjYzkVA7wHgFlLB6lChOKXH/AvVLXYYnBMpz9YyfaNxqJ7CmmOO9NULdAYjktA7Q54A2 ksAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=QGldav61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hr18si8499068ejc.704.2021.05.15.09.35.35; Sat, 15 May 2021 09:35:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.co.jp header.s=amazon201209 header.b=QGldav61; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.co.jp Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232426AbhEOEQC (ORCPT + 99 others); Sat, 15 May 2021 00:16:02 -0400 Received: from smtp-fw-6002.amazon.com ([52.95.49.90]:63728 "EHLO smtp-fw-6002.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229441AbhEOEQC (ORCPT ); Sat, 15 May 2021 00:16:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.co.jp; i=@amazon.co.jp; q=dns/txt; s=amazon201209; t=1621052090; x=1652588090; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=+aZD1zLSq6chFtKoY8/utueoK2N/X9wi5QRRMf7pO34=; b=QGldav61X4tYft18xyZ1ahhO2ylD8JKzIE/Vi3UyJlbIR+hAgsxCZeV9 LzRGKUlmXJER0S+J6OQizb/zeHevqbliAEZgFS40zeX3yxQBV3iDKjNtz 7AES2oBWSf7+TpUHHssfNke4LCnccNf70iPIhNllI+CKmELOfteTrZ+5b E=; X-IronPort-AV: E=Sophos;i="5.82,300,1613433600"; d="scan'208";a="112350225" Received: from iad12-co-svc-p1-lb1-vlan2.amazon.com (HELO email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com) ([10.43.8.2]) by smtp-border-fw-6002.iad6.amazon.com with ESMTP; 15 May 2021 04:14:48 +0000 Received: from EX13MTAUWB001.ant.amazon.com (pdx1-ws-svc-p6-lb9-vlan3.pdx.amazon.com [10.236.137.198]) by email-inbound-relay-2a-d0be17ee.us-west-2.amazon.com (Postfix) with ESMTPS id BFE74A18DF; Sat, 15 May 2021 04:14:47 +0000 (UTC) Received: from EX13D04ANC001.ant.amazon.com (10.43.157.89) by EX13MTAUWB001.ant.amazon.com (10.43.161.249) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 15 May 2021 04:14:47 +0000 Received: from 88665a182662.ant.amazon.com (10.43.162.28) by EX13D04ANC001.ant.amazon.com (10.43.157.89) with Microsoft SMTP Server (TLS) id 15.0.1497.18; Sat, 15 May 2021 04:14:41 +0000 From: Kuniyuki Iwashima To: CC: , , , , , , , , , , , Subject: Re: [PATCH v5 bpf-next 05/11] tcp: Migrate TCP_ESTABLISHED/TCP_SYN_RECV sockets in accept queues. Date: Sat, 15 May 2021 13:14:37 +0900 Message-ID: <20210515041438.81233-1-kuniyu@amazon.co.jp> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210515010616.uy5szaoqvjrn4qfv@kafai-mbp> References: <20210515010616.uy5szaoqvjrn4qfv@kafai-mbp> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.43.162.28] X-ClientProxiedBy: EX13D36UWB001.ant.amazon.com (10.43.161.84) To EX13D04ANC001.ant.amazon.com (10.43.157.89) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Martin KaFai Lau Date: Fri, 14 May 2021 18:06:16 -0700 > On Mon, May 10, 2021 at 12:44:27PM +0900, Kuniyuki Iwashima wrote: > > diff --git a/net/core/request_sock.c b/net/core/request_sock.c > > index f35c2e998406..7879a3660c52 100644 > > --- a/net/core/request_sock.c > > +++ b/net/core/request_sock.c > > @@ -130,3 +130,42 @@ void reqsk_fastopen_remove(struct sock *sk, struct request_sock *req, > > out: > > spin_unlock_bh(&fastopenq->lock); > > } > > + > > +struct request_sock *reqsk_clone(struct request_sock *req, struct sock *sk) > > +{ > > + struct sock *req_sk, *nreq_sk; > > + struct request_sock *nreq; > > + > > + nreq = kmem_cache_alloc(req->rsk_ops->slab, GFP_ATOMIC | __GFP_NOWARN); > > + if (!nreq) { > > + /* paired with refcount_inc_not_zero() in reuseport_migrate_sock() */ > > + sock_put(sk); > > + return NULL; > > + } > > + > > + req_sk = req_to_sk(req); > > + nreq_sk = req_to_sk(nreq); > > + > > + memcpy(nreq_sk, req_sk, > > + offsetof(struct sock, sk_dontcopy_begin)); > > + memcpy(&nreq_sk->sk_dontcopy_end, &req_sk->sk_dontcopy_end, > > + req->rsk_ops->obj_size - offsetof(struct sock, sk_dontcopy_end)); > > + > > + sk_node_init(&nreq_sk->sk_node); > > + nreq_sk->sk_tx_queue_mapping = req_sk->sk_tx_queue_mapping; > > +#ifdef CONFIG_XPS > > + nreq_sk->sk_rx_queue_mapping = req_sk->sk_rx_queue_mapping; > > +#endif > > + nreq_sk->sk_incoming_cpu = req_sk->sk_incoming_cpu; > > + refcount_set(&nreq_sk->sk_refcnt, 0); > > + > > + nreq->rsk_listener = sk; > > + > > + /* We need not acquire fastopenq->lock > > + * because the child socket is locked in inet_csk_listen_stop(). > > + */ > > + if (tcp_rsk(nreq)->tfo_listener) > Should IPPROTO_TCP be tested first like other similar situations > in inet_connection_sock.c? I've written this way because migration happens only in TCP for now, but I agree that test of IPPROTO_TCP makes less error-prone in the future. So, I'll test it first in the next spin. Thank you! > > Also, reqsk_clone() is only used in inet_connection_sock.c. > Can it be moved to inet_connection_sock.c instead and renamed to > inet_reqsk_clone()? I'll do that.