Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1110833pxb; Wed, 1 Sep 2021 17:55:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwf4UxasOWY3rgZX9zfK1O7hf+OIIU+E23PAtO/klHfUOwwDRtNITeqqR8rn9SFOYUVDVZ3 X-Received: by 2002:a6b:611a:: with SMTP id v26mr519442iob.93.1630544156208; Wed, 01 Sep 2021 17:55:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1630544156; cv=none; d=google.com; s=arc-20160816; b=E/Ot8gopNE/o+Om/pmvyIxhz4CCEcivNqr7TDw6LM6LNRGJhuAVOCxW6cL4Cj0UFkz OlFjZ5BZimT+ppgeLQ5pzshfRkd90IbI8CBJqaHY41Z2ZyZLwlfSvwHFA+bJsH6Yayj3 p/osW2w2PjpDnxn2jrZta0wHptQ5KjJ6nTgPgHM+HtLoEBNyJh62HY98NoVt2BxYqYE2 1mdXu1UqYBAYTnxNNGAq/2ElApggBDYTTmbskpPzbN9cXxjsGQp6yusdC9wOwhh8zTu7 2VPL2y6po/IFsUQsz0EdPQBJAbmbbP1ipqMGz67WWm1/zLSWxvbbVaXapYpcqiX95nJQ LVXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:references:cc :to:from:subject; bh=DbqJfswISCr8aRtm47dbtqsl/b2aMIKAlAV/qecUlX4=; b=yC7/BwH2GFHjk9L2YBbR5fzony3MzD5UYWvprmzK58RZV4YUevFTOuUi9anEnDR9xq 3Cx9pSSlBqt4ztDBdTObDeWbm3Ia+8whj6eo4etqX50GvW9fzl1wpR2sZRI09wK4hJer K65dtmpY3cvYf5MT1MHFyHsN+kuqIa9XFLBr+/K2J01abgW7Ma4T4vu6O4CR9//+1MfO koc4996J9mdDyd/z8x4m0CKGz4RG6pjwBPfWi0e0FKmrNM3TEuha6dYs+BJ3APGW5uVt M3nS3ZaynBexUBeTzAluENyKErCISC0q8I2RLQ2YcLuRYoA0NgOPxctzR1gQuIKqt1gw k1Kw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si274561ioe.21.2021.09.01.17.55.28; Wed, 01 Sep 2021 17:55:56 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231379AbhIBAsx (ORCPT + 99 others); Wed, 1 Sep 2021 20:48:53 -0400 Received: from szxga01-in.huawei.com ([45.249.212.187]:19001 "EHLO szxga01-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232731AbhIBAsw (ORCPT ); Wed, 1 Sep 2021 20:48:52 -0400 Received: from dggemv704-chm.china.huawei.com (unknown [172.30.72.57]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4H0McX2nhnzblQX; Thu, 2 Sep 2021 08:43:56 +0800 (CST) Received: from dggpemm500005.china.huawei.com (7.185.36.74) by dggemv704-chm.china.huawei.com (10.3.19.47) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Thu, 2 Sep 2021 08:47:52 +0800 Received: from [10.69.30.204] (10.69.30.204) by dggpemm500005.china.huawei.com (7.185.36.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Thu, 2 Sep 2021 08:47:51 +0800 Subject: Re: [PATCH net-next] tcp: add tcp_tx_skb_cache_key checking in sk_stream_alloc_skb() From: Yunsheng Lin To: , , CC: , , , , References: <1630492744-60396-1-git-send-email-linyunsheng@huawei.com> Message-ID: Date: Thu, 2 Sep 2021 08:47:51 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.0 MIME-Version: 1.0 In-Reply-To: <1630492744-60396-1-git-send-email-linyunsheng@huawei.com> Content-Type: text/plain; charset="utf-8" Content-Language: en-US Content-Transfer-Encoding: 7bit X-Originating-IP: [10.69.30.204] X-ClientProxiedBy: dggeme704-chm.china.huawei.com (10.1.199.100) To dggpemm500005.china.huawei.com (7.185.36.74) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2021/9/1 18:39, Yunsheng Lin wrote: > Since tcp_tx_skb_cache is disabled by default in: > commit 0b7d7f6b2208 ("tcp: add tcp_tx_skb_cache sysctl") > > Add tcp_tx_skb_cache_key checking in sk_stream_alloc_skb() to > avoid possible branch-misses. > > Signed-off-by: Yunsheng Lin > --- > Also, the sk->sk_tx_skb_cache may be both changed by allocation > and freeing side, I assume there may be some implicit protection > here too, such as the NAPI protection for rx? Hi, Eric Is there any implicit protection for sk->sk_tx_skb_cache? As my understanding, sk_stream_alloc_skb() seems to be protected by lock_sock(), and the sk_wmem_free_skb() seems to be mostly happening in NAPI polling for TCP(when ack packet is received) without lock_sock(), so it seems there is no protection here? >