{"id":829863,"url":"http://patchwork.ozlabs.org/api/1.2/patches/829863/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/patch/cb6e9e39bdcdaebba87e331d7b18392bdeefebc3.1508841595.git.pabeni@redhat.com/","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":"<cb6e9e39bdcdaebba87e331d7b18392bdeefebc3.1508841595.git.pabeni@redhat.com>","list_archive_url":null,"date":"2017-10-24T10:41:01","name":"[net-next] net: updating dst lastusage is an unlikely event.","commit_ref":null,"pull_url":null,"state":"accepted","archived":true,"hash":"5d5ee28da7136ca0e5492040587a40f48dada229","submitter":{"id":67312,"url":"http://patchwork.ozlabs.org/api/1.2/people/67312/?format=json","name":"Paolo Abeni","email":"pabeni@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/cb6e9e39bdcdaebba87e331d7b18392bdeefebc3.1508841595.git.pabeni@redhat.com/mbox/","series":[{"id":9964,"url":"http://patchwork.ozlabs.org/api/1.2/series/9964/?format=json","web_url":"http://patchwork.ozlabs.org/project/netdev/list/?series=9964","date":"2017-10-24T10:41:01","name":"[net-next] net: updating dst lastusage is an unlikely event.","version":1,"mbox":"http://patchwork.ozlabs.org/series/9964/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/829863/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/829863/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-mx07.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com","ext-mx07.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=pabeni@redhat.com"],"Received":["from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3yLqZ04pKyz9sNw\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue, 24 Oct 2017 21:41:11 +1100 (AEDT)","(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751769AbdJXKlJ (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 24 Oct 2017 06:41:09 -0400","from mx1.redhat.com ([209.132.183.28]:32878 \"EHLO mx1.redhat.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S932148AbdJXKlH (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 24 Oct 2017 06:41:07 -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 50624C00F7D9;\n\tTue, 24 Oct 2017 10:41:07 +0000 (UTC)","from localhost.localdomain.com (unknown [10.32.181.195])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1604F60841;\n\tTue, 24 Oct 2017 10:41:05 +0000 (UTC)"],"DMARC-Filter":"OpenDMARC Filter v1.3.2 mx1.redhat.com 50624C00F7D9","From":"Paolo Abeni <pabeni@redhat.com>","To":"netdev@vger.kernel.org","Cc":"\"David S. Miller\" <davem@davemloft.net>,\n\tWei Wang <weiwan@google.com>, Martin KaFai Lau <kafai@fb.com>,\n\tHannes Frederic Sowa <hannes@stressinduktion.org>","Subject":"[PATCH net-next] net: updating dst lastusage is an unlikely event.","Date":"Tue, 24 Oct 2017 12:41:01 +0200","Message-Id":"<cb6e9e39bdcdaebba87e331d7b18392bdeefebc3.1508841595.git.pabeni@redhat.com>","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.31]);\n\tTue, 24 Oct 2017 10:41:07 +0000 (UTC)","Sender":"netdev-owner@vger.kernel.org","Precedence":"bulk","List-ID":"<netdev.vger.kernel.org>","X-Mailing-List":"netdev@vger.kernel.org"},"content":"Since commit 0da4af00b2ed (\"ipv6: only update __use and lastusetime\nonce per jiffy at most\"), updating the dst lastuse field is an\nunlikely action: it happens at most once per jiffy, out of\npotentially millions of calls per second.\n\nMark explicitly the code as such, and let the compiler generate\nbetter code.\n\nNote: gcc 7.2 and several older versions do actually generate\ndifferent - better - code when the unlikely() hint is in place,\navoid jump in the fast path and keeping better code locality.\n\nSigned-off-by: Paolo Abeni <pabeni@redhat.com>\n---\n include/net/dst.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)","diff":"diff --git a/include/net/dst.h b/include/net/dst.h\nindex d70b33dc2332..0744a9630eed 100644\n--- a/include/net/dst.h\n+++ b/include/net/dst.h\n@@ -257,7 +257,7 @@ static inline void dst_hold(struct dst_entry *dst)\n \n static inline void dst_use_noref(struct dst_entry *dst, unsigned long time)\n {\n-\tif (time != dst->lastuse) {\n+\tif (unlikely(time != dst->lastuse)) {\n \t\tdst->__use++;\n \t\tdst->lastuse = time;\n \t}\n","prefixes":["net-next"]}