{"id":832928,"url":"http://patchwork.ozlabs.org/api/1.2/patches/832928/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/150953668583.30172.5069550217700139382.stgit@firesoul/","project":{"id":7,"url":"http://patchwork.ozlabs.org/api/1.2/projects/7/?format=json","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":"<150953668583.30172.5069550217700139382.stgit@firesoul>","list_archive_url":null,"date":"2017-11-01T11:44:45","name":"[net-next] bpf: cpumap micro-optimization in cpu_map_enqueue","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"e1a05b8ea2ea5e91cb7e5179ea357098b322ed2a","submitter":{"id":13625,"url":"http://patchwork.ozlabs.org/api/1.2/people/13625/?format=json","name":"Jesper Dangaard Brouer","email":"brouer@redhat.com"},"delegate":{"id":34,"url":"http://patchwork.ozlabs.org/api/1.2/users/34/?format=json","username":"davem","first_name":"David","last_name":"Miller","email":"davem@davemloft.net"},"mbox":"http://patchwork.ozlabs.org/project/netdev/patch/150953668583.30172.5069550217700139382.stgit@firesoul/mbox/","series":[{"id":11317,"url":"http://patchwork.ozlabs.org/api/1.2/series/11317/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=11317","date":"2017-11-01T11:44:45","name":"[net-next] bpf: cpumap micro-optimization in cpu_map_enqueue","version":1,"mbox":"http://patchwork.ozlabs.org/series/11317/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/832928/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/832928/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>)","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx10.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=brouer@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yRmbp5fS9z9sP1\n\tfor <patchwork-incoming@ozlabs.org>;\n\tWed,  1 Nov 2017 22:44:54 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754504AbdKALou (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tWed, 1 Nov 2017 07:44:50 -0400","from mx1.redhat.com ([209.132.183.28]:45856 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1753734AbdKALot (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tWed, 1 Nov 2017 07:44:49 -0400","from smtp.corp.redhat.com\n\t(int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 379AA5F739\n\tfor <netdev@vger.kernel.org>; Wed,  1 Nov 2017 11:44:49 +0000 (UTC)","from firesoul.localdomain (ovpn-200-38.brq.redhat.com\n\t[10.40.200.38])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id E446A60621;\n\tWed,  1 Nov 2017 11:44:46 +0000 (UTC)","from [192.168.5.1] (localhost [IPv6:::1])\n\tby firesoul.localdomain (Postfix) with ESMTP id DBE013073CDE0;\n\tWed,  1 Nov 2017 12:44:45 +0100 (CET)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 379AA5F739","Subject":"[net-next PATCH] bpf: cpumap micro-optimization in cpu_map_enqueue","From":"Jesper Dangaard Brouer <brouer@redhat.com>","To":"netdev@vger.kernel.org","Cc":"Jesper Dangaard Brouer <brouer@redhat.com>","Date":"Wed, 01 Nov 2017 12:44:45 +0100","Message-ID":"<150953668583.30172.5069550217700139382.stgit@firesoul>","User-Agent":"StGit/0.17.1-dirty","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"7bit","X-Scanned-By":"MIMEDefang 2.79 on 10.5.11.13","X-Greylist":"Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.39]);\n\tWed, 01 Nov 2017 11:44:49 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Discovered that the compiler laid-out asm code in suboptimal way\nwhen studying perf report during benchmarking of cpumap. Help\nthe compiler by the marking unlikely code paths.\n\nSigned-off-by: Jesper Dangaard Brouer <brouer@redhat.com>\n---\n kernel/bpf/cpumap.c |    4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)","diff":"diff --git a/kernel/bpf/cpumap.c b/kernel/bpf/cpumap.c\nindex 86e29cbf7827..ce5b669003b2 100644\n--- a/kernel/bpf/cpumap.c\n+++ b/kernel/bpf/cpumap.c\n@@ -208,7 +208,7 @@ static struct xdp_pkt *convert_to_xdp_pkt(struct xdp_buff *xdp)\n \theadroom = xdp->data - xdp->data_hard_start;\n \tmetasize = xdp->data - xdp->data_meta;\n \tmetasize = metasize > 0 ? metasize : 0;\n-\tif ((headroom - metasize) < sizeof(*xdp_pkt))\n+\tif (unlikely((headroom - metasize) < sizeof(*xdp_pkt)))\n \t\treturn NULL;\n \n \t/* Store info in top of packet */\n@@ -656,7 +656,7 @@ int cpu_map_enqueue(struct bpf_cpu_map_entry *rcpu, struct xdp_buff *xdp,\n \tstruct xdp_pkt *xdp_pkt;\n \n \txdp_pkt = convert_to_xdp_pkt(xdp);\n-\tif (!xdp_pkt)\n+\tif (unlikely(!xdp_pkt))\n \t\treturn -EOVERFLOW;\n \n \t/* Info needed when constructing SKB on remote CPU */\n","prefixes":["net-next"]}