Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp675081pxb; Tue, 2 Feb 2021 15:10:37 -0800 (PST) X-Google-Smtp-Source: ABdhPJx8HLvqif/4ysOWPTPSpxfSlCM1ssK4yDuRQx8MoRPVCw6sTMvMDA5N+dqf55tNPqU68mzq X-Received: by 2002:aa7:db1a:: with SMTP id t26mr395982eds.25.1612307437324; Tue, 02 Feb 2021 15:10:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612307437; cv=none; d=google.com; s=arc-20160816; b=ukwKjqT1ypyChLDCKD0G+Dy5waqQnbO+IX3HFGLOdv/j67d1LimbTrqBPWOARp9FoP tALJRtszGik0bafkCd0DaWGImOQUnZqSkGemRBUYKfyufSTm7hixt4/Y1skTzBOlRxmK f4uzeK00/h6dv5PZ7NxbTF+jbVAgjr/vunSJMnTDfRuN/g6sCQ7l7ONcln8IzpaPpmMI 6gOIhg7LErCTqJXBr9l158yR6pymke20CrtI1iGPLG5X04Zn8TiKvwNJdQC4wT/+2Q+V mNv0wxxyxKzRvXeMaLku1eZUiDpZ6k4qw/nwZiIdkZbNepLRT5wg3aTwUr18kh+nJLDl 1OMQ== 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:subject:cc:to:from:date :dkim-signature; bh=1fxbB5CbdngwBsbkBcWlduiGgNHHIUAwAFLoJsrEZD0=; b=pHAKr2naE03F+y4vBS846D7M2qhkyX01xpyiJ+46YSYjeyqQFtnNVAi+EEyu8ufLr3 0n4WwQI3LZzQVeQi2MmM598tAJTYYqo++2PIgQs5k5L7T3dejoNalgYP6kIsjy7flR7C TKNAe1En+vYhvnKqJYibydUu7RErBFTlttDuHJ1RNjRpy4TBm5UpESGz30H8oBGkdXad ePwCSP87tzNp+RtTQUsUR7CEb/nkL6zweCuO8bmSgSS2ig40EO6AaehLfwwIGCqGx4c3 OvVwn3jkOq844HotwDlfCCHv2MdCPpl7y04YBjJXTsiWR1BFVY3bmzkMRFtIR0khvP62 HccQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="t/lvXoPo"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dc6si179403ejb.54.2021.02.02.15.10.13; Tue, 02 Feb 2021 15:10:37 -0800 (PST) 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=@kernel.org header.s=k20201202 header.b="t/lvXoPo"; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236798AbhBBQo1 (ORCPT + 99 others); Tue, 2 Feb 2021 11:44:27 -0500 Received: from mail.kernel.org ([198.145.29.99]:33620 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236745AbhBBQmW (ORCPT ); Tue, 2 Feb 2021 11:42:22 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id B1FBB64F64; Tue, 2 Feb 2021 16:41:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1612284102; bh=L71Awcg/HF6WOIMSygGKnyNZDF81guEDZR3Xldfh3NA=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=t/lvXoPoVfVH2sMKx9lhcgnIVnDuG8zHsBYJnBELL8MsYb3fYw8jDBY5avGdq6/bF iXVk+/LgiRNoAPxO8rOn1PqxfISapICLFR1AdqPH+vW1oQ7Jz0mHy1HYKNUrXfwbLe sg/2IxwDzoABo+UlXJu4qcCcIsjC8UVEp3RZip06hSasUCrRG8Xy8CTIgyt2CN17TC 8xE82v0SkQ0O6vEchROia2UtCKHFyLXf9zLCIqpdvXv62LsfWFD/ShiszEZlJZs5ah cn/cNa/RyBM7GJqTSWHWEWrDWeDDGcz0G5vvfn3UqGECINpa3XLEbe23y+CH9/u5fF jkTlhB2+8MW9g== Date: Tue, 2 Feb 2021 08:41:40 -0800 From: Jakub Kicinski To: Xie He Cc: Julian Wiedmann , "David S. Miller" , Linux X25 , Linux Kernel Network Developers , LKML , Martin Schiller Subject: Re: [PATCH net] net: lapb: Copy the skb before sending a packet Message-ID: <20210202084140.642a9cc1@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> In-Reply-To: References: <20210201055706.415842-1-xie.he.0141@gmail.com> <4d1988d9-6439-ae37-697c-d2b970450498@linux.ibm.com> <20210201204224.4872ce23@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 1 Feb 2021 22:25:17 -0800 Xie He wrote: > On Mon, Feb 1, 2021 at 8:42 PM Jakub Kicinski wrote: > > > > On Mon, 1 Feb 2021 08:14:31 -0800 Xie He wrote: > > > On Mon, Feb 1, 2021 at 6:10 AM Julian Wiedmann wrote: > [...] > > > > > > Calling "skb_cow_head" before we call "skb_clone" would indeed solve > > > the problem of writes to our clones affecting clones in other parts of > > > the system. But since we are still writing to the skb after > > > "skb_clone", it'd still be better to replace "skb_clone" with > > > "skb_copy" to avoid interference between our own clones. > > > > Why call skb_cow_head() before skb_clone()? skb_cow_head should be > > called before the data in skb head is modified. I'm assuming you're only > > modifying "front" of the frame, right? skb_cow_head() should do nicely > > in that case. > > The modification happens after skb_clone. If we call skb_cow_head > after skb_clone (before the modification), then skb_cow_head would > always see that the skb is a clone and would always copy it. Therefore > skb_clone + skb_cow_head is equivalent to skb_copy. You're right. I thought cow_head is a little more clever.