Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/808476/?format=api
{ "id": 808476, "url": "http://patchwork.ozlabs.org/api/patches/808476/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/20170831234822.26612-2-edumazet@google.com/", "project": { "id": 7, "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api", "name": "Linux network development", "link_name": "netdev", "list_id": "netdev.vger.kernel.org", "list_email": "netdev@vger.kernel.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170831234822.26612-2-edumazet@google.com>", "list_archive_url": null, "date": "2017-08-31T23:48:21", "name": "[v2,net-next,1/2] net: prepare (struct ubuf_info)->refcnt conversion", "commit_ref": null, "pull_url": null, "state": "accepted", "archived": true, "hash": "67f38ec8bde87d4bc2e34eccf11c4b3a0ab1e943", "submitter": { "id": 13357, "url": "http://patchwork.ozlabs.org/api/people/13357/?format=api", "name": "Eric Dumazet", "email": "edumazet@google.com" }, "delegate": { "id": 34, "url": "http://patchwork.ozlabs.org/api/users/34/?format=api", "username": "davem", "first_name": "David", "last_name": "Miller", "email": "davem@davemloft.net" }, "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/20170831234822.26612-2-edumazet@google.com/mbox/", "series": [ { "id": 927, "url": "http://patchwork.ozlabs.org/api/series/927/?format=api", "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=927", "date": "2017-08-31T23:48:20", "name": "net: ubuf_info.refcnt conversion", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/927/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/808476/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/808476/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<netdev-owner@vger.kernel.org>", "X-Original-To": "patchwork-incoming@ozlabs.org", "Delivered-To": "patchwork-incoming@ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)", "ozlabs.org; dkim=pass (2048-bit key;\n\tunprotected) header.d=google.com header.i=@google.com\n\theader.b=\"ur2JQysi\"; dkim-atps=neutral" ], "Received": [ "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xjzbP5ddxz9s7p\n\tfor <patchwork-incoming@ozlabs.org>;\n\tFri, 1 Sep 2017 09:48:33 +1000 (AEST)", "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752180AbdHaXsc (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tThu, 31 Aug 2017 19:48:32 -0400", "from mail-pf0-f172.google.com ([209.85.192.172]:34828 \"EHLO\n\tmail-pf0-f172.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751848AbdHaXs3 (ORCPT\n\t<rfc822;netdev@vger.kernel.org>); Thu, 31 Aug 2017 19:48:29 -0400", "by mail-pf0-f172.google.com with SMTP id g13so3216735pfm.2\n\tfor <netdev@vger.kernel.org>; Thu, 31 Aug 2017 16:48:29 -0700 (PDT)", "from localhost ([2620:15c:2cb:201:df6:9252:fc0d:50b2])\n\tby smtp.gmail.com with ESMTPSA id\n\tw124sm862002pfd.179.2017.08.31.16.48.28\n\t(version=TLS1_2 cipher=AES128-SHA bits=128/128);\n\tThu, 31 Aug 2017 16:48:28 -0700 (PDT)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=google.com; s=20161025;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=N3ykPrdnC8qzEgavJW+/7olKOgVVgIW8A9lbCYAq+0s=;\n\tb=ur2JQysiVqRz8DaLUhjyfy9JkMkdshV485YVpOaFIpFNHznHw6ghdCcaM6LDTGtW3b\n\tbMOxEmtFfsHQXBTdumhveaygxK11sSdkncywazQg92dLQF/GVEhssDOI0fjjpkyVDFDQ\n\tYg4KMCYF+3b+DQ5qcvo58MJ7YS5/wlTn8ZsgHZC2JLVj1yl0wPfhLlcvA1oO4qpi0MFT\n\tNnA9AL0vcHHlTUW6ZjapwW7EnPAR1xtBYSLtXEqMGA/cTMYmOO3GlX1UZWqZsaJrQDl0\n\tFEJ/3qiTtJd3VuIF2dSfbfM90wlpBTT4TwTwWv7CoP9JTBfVNtaSALML/vcEBGCtos0j\n\tBgYQ==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=N3ykPrdnC8qzEgavJW+/7olKOgVVgIW8A9lbCYAq+0s=;\n\tb=UEko9H1glyc5Q0tk+C7EyNwY0XtdUXsh03ujzRBRIp2QcpHtiDePNxA9bgFpVl9Rbs\n\tRBRcVdRGZyAARg7S0sSGdCVimen7J/UUHJaAlorxY23FADYL1LjmHIHCSS2RTv2iRqgg\n\tFQ6Cli0YCcGQM9doubcoy1t8RLgIW/mfeqZcSO34aWcBfKvddMTJhgHDB0tOuoHUEIgM\n\ttUfuQNuCZPYNdJD4z+3EQ8+nHwqCCXvbbTk7LPIVFeDNo8/nDeNG7STPm37Et+NJFu95\n\tBez+IKq9TZSPMUUAn6zQXWBrHfTXi8FGBzQ5RlFsycTjNE+t5YAAKON4aFVsUHNtLlKG\n\t0nHA==", "X-Gm-Message-State": "AHPjjUj5MmCNwyypGnC4xmZ1GE3ic69ps45E633l0s+sR4KS3fhHqAPu\n\tas8BuD0udWvm3Czn", "X-Google-Smtp-Source": "ADKCNb62TwhIarlijmODFJMjO+RT9EIanoVvMRKn49HIgPT40+YwS3HxtRbmTgKBjIWsIU/aVb0ARg==", "X-Received": "by 10.98.13.201 with SMTP id 70mr169343pfn.9.1504223308880;\n\tThu, 31 Aug 2017 16:48:28 -0700 (PDT)", "From": "Eric Dumazet <edumazet@google.com>", "To": "\"David S . Miller\" <davem@davemloft.net>", "Cc": "netdev <netdev@vger.kernel.org>, Willem de Bruijn <willemb@google.com>,\n\tEric Dumazet <edumazet@google.com>, Eric Dumazet <eric.dumazet@gmail.com>", "Subject": "[PATCH v2 net-next 1/2] net: prepare (struct ubuf_info)->refcnt\n\tconversion", "Date": "Thu, 31 Aug 2017 16:48:21 -0700", "Message-Id": "<20170831234822.26612-2-edumazet@google.com>", "X-Mailer": "git-send-email 2.14.1.581.gf28d330327-goog", "In-Reply-To": "<20170831234822.26612-1-edumazet@google.com>", "References": "<20170831234822.26612-1-edumazet@google.com>", "Sender": "netdev-owner@vger.kernel.org", "Precedence": "bulk", "List-ID": "<netdev.vger.kernel.org>", "X-Mailing-List": "netdev@vger.kernel.org" }, "content": "In order to convert this atomic_t refcnt to refcount_t,\nwe need to init the refcount to one to not trigger\na 0 -> 1 transition.\n\nThis also removes one atomic operation in fast path.\n\nv2: removed dead code in sock_zerocopy_put_abort()\nas suggested by Willem.\n\nSigned-off-by: Eric Dumazet <edumazet@google.com>\n---\n net/core/skbuff.c | 10 ++--------\n net/ipv4/tcp.c | 2 --\n 2 files changed, 2 insertions(+), 10 deletions(-)", "diff": "diff --git a/net/core/skbuff.c b/net/core/skbuff.c\nindex 917da73d3ab3b82163cf0a9ee944da09cb5a391f..1a754d7896ceac1eb85e3b13c1422b4d6a88fedf 100644\n--- a/net/core/skbuff.c\n+++ b/net/core/skbuff.c\n@@ -963,7 +963,7 @@ struct ubuf_info *sock_zerocopy_alloc(struct sock *sk, size_t size)\n \tuarg->len = 1;\n \tuarg->bytelen = size;\n \tuarg->zerocopy = 1;\n-\tatomic_set(&uarg->refcnt, 0);\n+\tatomic_set(&uarg->refcnt, 1);\n \tsock_hold(sk);\n \n \treturn uarg;\n@@ -1005,6 +1005,7 @@ struct ubuf_info *sock_zerocopy_realloc(struct sock *sk, size_t size,\n \t\t\tuarg->len++;\n \t\t\tuarg->bytelen = bytelen;\n \t\t\tatomic_set(&sk->sk_zckey, ++next);\n+\t\t\tsock_zerocopy_get(uarg);\n \t\t\treturn uarg;\n \t\t}\n \t}\n@@ -1102,13 +1103,6 @@ void sock_zerocopy_put_abort(struct ubuf_info *uarg)\n \t\tatomic_dec(&sk->sk_zckey);\n \t\tuarg->len--;\n \n-\t\t/* sock_zerocopy_put expects a ref. Most sockets take one per\n-\t\t * skb, which is zero on abort. tcp_sendmsg holds one extra, to\n-\t\t * avoid an skb send inside the main loop triggering uarg free.\n-\t\t */\n-\t\tif (sk->sk_type != SOCK_STREAM)\n-\t\t\tatomic_inc(&uarg->refcnt);\n-\n \t\tsock_zerocopy_put(uarg);\n \t}\n }\ndiff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c\nindex 21ca2df274c5130a13d31a391a1408d779af34af..fff4d7bc3b8b46174e7bd0a04d7c212307e55cb5 100644\n--- a/net/ipv4/tcp.c\n+++ b/net/ipv4/tcp.c\n@@ -1190,8 +1190,6 @@ int tcp_sendmsg_locked(struct sock *sk, struct msghdr *msg, size_t size)\n \t\t\tgoto out_err;\n \t\t}\n \n-\t\t/* skb may be freed in main loop, keep extra ref on uarg */\n-\t\tsock_zerocopy_get(uarg);\n \t\tif (!(sk_check_csum_caps(sk) && sk->sk_route_caps & NETIF_F_SG))\n \t\t\tuarg->zerocopy = 0;\n \t}\n", "prefixes": [ "v2", "net-next", "1/2" ] }