From: Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>
To: Matthias Tafelmeier <matthias.tafelmeier@gmx.net>
Cc: netdev@vger.kernel.org, hagen@jauu.net, fw@strlen.de,
edumazet@google.com, daniel@iogearbox.net
Subject: Re: [PATCH] net: dev_weight: TX/RX orthogonality
Date: Tue, 27 Dec 2016 14:47:58 -0200 [thread overview]
Message-ID: <20161227164758.GA10870@localhost.localdomain> (raw)
In-Reply-To: <1482827147-7535-1-git-send-email-matthias.tafelmeier@gmx.net>
On Tue, Dec 27, 2016 at 09:25:47AM +0100, Matthias Tafelmeier wrote:
> Oftenly, introducing side effects on packet processing on the other half
> of the stack by adjusting one of TX/RX via sysctl is not desirable.
> There are cases of demand for asymmetric, orthogonal configurability.
>
> This holds true especially for nodes where RPS for RFS usage on top is
> configured and therefore use the 'old dev_weight'. This is quite a
> common base configuration setup nowadays, even with NICs of superior processing
> support (e.g. aRFS).
>
> A good example use case are nodes acting as noSQL data bases with a
> large number of tiny requests and rather fewer but large packets as responses.
> It's affordable to have large budget and rx dev_weights for the
> requests. But as a side effect having this large a number on TX
> processed in one run can overwhelm drivers.
>
> This patch therefore introduces an independent configurability via sysctl to
> userland.
> ---
> include/linux/netdevice.h | 2 ++
> net/core/dev.c | 4 +++-
> net/core/sysctl_net_core.c | 14 ++++++++++++++
> net/sched/sch_generic.c | 2 +-
> 4 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 994f742..bb331e0 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -3795,6 +3795,8 @@ void netdev_stats_to_stats64(struct rtnl_link_stats64 *stats64,
> extern int netdev_max_backlog;
> extern int netdev_tstamp_prequeue;
> extern int weight_p;
> +extern int dev_w_rx_bias;
> +extern int dev_w_tx_bias;
>
> bool netdev_has_upper_dev(struct net_device *dev, struct net_device *upper_dev);
> struct net_device *netdev_upper_get_next_dev_rcu(struct net_device *dev,
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 8db5a0b..0dcbd28 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -3428,6 +3428,8 @@ EXPORT_SYMBOL(netdev_max_backlog);
> int netdev_tstamp_prequeue __read_mostly = 1;
> int netdev_budget __read_mostly = 300;
> int weight_p __read_mostly = 64; /* old backlog weight */
> +int dev_w_rx_bias __read_mostly = 1; /* bias for backlog weight */
> +int dev_w_tx_bias __read_mostly = 1; /* bias for output_queue quota */
>
> /* Called with irq disabled */
> static inline void ____napi_schedule(struct softnet_data *sd,
> @@ -4833,7 +4835,7 @@ static int process_backlog(struct napi_struct *napi, int quota)
> net_rps_action_and_irq_enable(sd);
> }
>
> - napi->weight = weight_p;
> + napi->weight = weight_p * dev_w_rx_bias;
> while (again) {
> struct sk_buff *skb;
>
> diff --git a/net/core/sysctl_net_core.c b/net/core/sysctl_net_core.c
> index 2a46e40..a2ab149 100644
> --- a/net/core/sysctl_net_core.c
> +++ b/net/core/sysctl_net_core.c
> @@ -276,6 +276,20 @@ static struct ctl_table net_core_table[] = {
> .proc_handler = proc_dointvec
> },
> {
> + .procname = "dev_w_rx_bias",
> + .data = &dev_w_rx_bias,
> + .maxlen = sizeof(int),
> + .mode = 0644,
> + .proc_handler = proc_dointvec
> + },
> + {
> + .procname = "dev_w_tx_bias",
> + .data = &dev_w_tx_bias,
> + .maxlen = sizeof(int),
> + .mode = 0644,
> + .proc_handler = proc_dointvec
> + },
> + {
Please describe these at Documentation/sysctl/net.txt, probably right
after dev_weight.
I'm not sure about the abbreviation, maybe it would be better the longer
name as it doesn't block tab completion.
dev_weight_tx_bias
dev_weight_rx_bias
dev_weight
> .procname = "netdev_max_backlog",
> .data = &netdev_max_backlog,
> .maxlen = sizeof(int),
> diff --git a/net/sched/sch_generic.c b/net/sched/sch_generic.c
> index 6eb9c8e..4c07780 100644
> --- a/net/sched/sch_generic.c
> +++ b/net/sched/sch_generic.c
> @@ -247,7 +247,7 @@ static inline int qdisc_restart(struct Qdisc *q, int *packets)
>
> void __qdisc_run(struct Qdisc *q)
> {
> - int quota = weight_p;
> + int quota = weight_p * dev_w_tx_bias;
> int packets;
>
> while (qdisc_restart(q, &packets)) {
> --
> 2.7.4
>
next prev parent reply other threads:[~2016-12-27 16:48 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-12-26 9:49 [PATCH v1] net: dev_weight: TX/RX orthogonality Matthias Tafelmeier
2016-12-26 15:52 ` David Miller
[not found] ` <ae0712c3-61c6-432e-78d9-665d0c291c9f@gmx.net>
2016-12-26 16:58 ` [PATCH v1] net: dev_weight: TX/RX orthogonality,Re: " David Miller
2016-12-27 8:25 ` [PATCH] " Matthias Tafelmeier
2016-12-27 16:47 ` Marcelo Ricardo Leitner [this message]
2016-12-27 17:29 ` Matthias Tafelmeier
2016-12-28 9:42 ` [PATCH v3] " Matthias Tafelmeier
2016-12-28 19:17 ` David Miller
2016-12-29 9:58 ` [PATCH v4] " Matthias Tafelmeier
2016-12-29 19:08 ` David Miller
2016-12-29 19:23 ` Matthias Tafelmeier
2016-12-29 19:44 ` David Miller
2016-12-29 19:45 ` David Miller
2016-12-29 19:53 ` Matthias Tafelmeier
2016-12-29 20:37 ` [PATCH v5] " Matthias Tafelmeier
2016-12-30 1:16 ` David Miller
2017-02-13 20:22 ` Matthias Tafelmeier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20161227164758.GA10870@localhost.localdomain \
--to=marcelo.leitner@gmail.com \
--cc=daniel@iogearbox.net \
--cc=edumazet@google.com \
--cc=fw@strlen.de \
--cc=hagen@jauu.net \
--cc=matthias.tafelmeier@gmx.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).