From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f182.google.com ([209.85.192.182]:34000 "EHLO mail-pf0-f182.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932359AbeCLSqB (ORCPT ); Mon, 12 Mar 2018 14:46:01 -0400 Received: by mail-pf0-f182.google.com with SMTP id j20so4747699pfi.1 for ; Mon, 12 Mar 2018 11:46:01 -0700 (PDT) Date: Mon, 12 Mar 2018 11:45:52 -0700 From: Stephen Hemminger To: Eric Dumazet , David Miller Cc: netdev@vger.kernel.org Subject: de-indirect TCP congestion control Message-ID: <20180312114552.3f51e6ac@xeon-e3> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: netdev-owner@vger.kernel.org List-ID: Since indirect calls are expensive, and now even more so, perhaps we should figure out a way to make the default TCP congestion control hooks into direct calls. 99% of the users just use the single CC module compiled into the kernel. Use some macros (or other stuff) to change indirect call to direct calls. So that code like: static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) { const struct inet_connection_sock *icsk = inet_csk(sk); icsk->icsk_ca_ops->cong_avoid(sk, ack, acked); to: static void tcp_cong_avoid(struct sock *sk, u32 ack, u32 acked) { const struct tcp_congestion_ops *ops = inet_csk(sk)->icsk_ca_ops; if (ops == default_tcp_ops) default_tcp_cong_avoid(s, ack, acked); else icsk->icsk_ca_ops->cong_avoid(sk, ack, acked); The use macros and/or compiler symbols so the builtin (non-module) congestion control is always default_tcp_XXX.