* [PATCH v2] net: reimplement softnet_data.output_queue as a FIFO queue
@ 2010-04-27 9:06 Changli Gao
2010-04-27 20:36 ` Eric Dumazet
0 siblings, 1 reply; 3+ messages in thread
From: Changli Gao @ 2010-04-27 9:06 UTC (permalink / raw)
To: David S. Miller; +Cc: Eric Dumazet, netdev, Changli Gao
reimplement softnet_data.output_queue as a FIFO queue.
reimplement softnet_data.output_queue as a FIFO queue to keep the fairness among
the qdiscs rescheduled.
Signed-off-by: Changli Gao <xiaosuo@gmail.com>
----
include/linux/netdevice.h | 1 +
net/core/dev.c | 22 ++++++++++++----------
2 files changed, 13 insertions(+), 10 deletions(-)
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 3c5ed5f..c04ca24 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1385,6 +1385,7 @@ static inline int unregister_gifconf(unsigned int family)
*/
struct softnet_data {
struct Qdisc *output_queue;
+ struct Qdisc **output_queue_tailp;
struct list_head poll_list;
struct sk_buff *completion_queue;
diff --git a/net/core/dev.c b/net/core/dev.c
index 4d43f1a..3d31491 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -1557,8 +1557,9 @@ static inline void __netif_reschedule(struct Qdisc *q)
local_irq_save(flags);
sd = &__get_cpu_var(softnet_data);
- q->next_sched = sd->output_queue;
- sd->output_queue = q;
+ q->next_sched = NULL;
+ *sd->output_queue_tailp = q;
+ sd->output_queue_tailp = &q->next_sched;
raise_softirq_irqoff(NET_TX_SOFTIRQ);
local_irq_restore(flags);
}
@@ -2529,6 +2530,7 @@ static void net_tx_action(struct softirq_action *h)
local_irq_disable();
head = sd->output_queue;
sd->output_queue = NULL;
+ sd->output_queue_tailp = &sd->output_queue;
local_irq_enable();
while (head) {
@@ -5594,7 +5596,6 @@ static int dev_cpu_callback(struct notifier_block *nfb,
void *ocpu)
{
struct sk_buff **list_skb;
- struct Qdisc **list_net;
struct sk_buff *skb;
unsigned int cpu, oldcpu = (unsigned long)ocpu;
struct softnet_data *sd, *oldsd;
@@ -5615,13 +5616,13 @@ static int dev_cpu_callback(struct notifier_block *nfb,
*list_skb = oldsd->completion_queue;
oldsd->completion_queue = NULL;
- /* Find end of our output_queue. */
- list_net = &sd->output_queue;
- while (*list_net)
- list_net = &(*list_net)->next_sched;
/* Append output queue from offline CPU. */
- *list_net = oldsd->output_queue;
- oldsd->output_queue = NULL;
+ if (oldsd->output_queue) {
+ *sd->output_queue_tailp = oldsd->output_queue;
+ sd->output_queue_tailp = oldsd->output_queue_tailp;
+ oldsd->output_queue = NULL;
+ oldsd->output_queue_tailp = &oldsd->output_queue;
+ }
raise_softirq_irqoff(NET_TX_SOFTIRQ);
local_irq_enable();
@@ -5851,7 +5852,8 @@ static int __init net_dev_init(void)
skb_queue_head_init(&sd->input_pkt_queue);
sd->completion_queue = NULL;
INIT_LIST_HEAD(&sd->poll_list);
-
+ sd->output_queue = NULL;
+ sd->output_queue_tailp = &sd->output_queue;
#ifdef CONFIG_RPS
sd->csd.func = rps_trigger_softirq;
sd->csd.info = sd;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: reimplement softnet_data.output_queue as a FIFO queue
2010-04-27 9:06 [PATCH v2] net: reimplement softnet_data.output_queue as a FIFO queue Changli Gao
@ 2010-04-27 20:36 ` Eric Dumazet
2010-04-27 21:32 ` David Miller
0 siblings, 1 reply; 3+ messages in thread
From: Eric Dumazet @ 2010-04-27 20:36 UTC (permalink / raw)
To: Changli Gao; +Cc: David S. Miller, netdev
Le mardi 27 avril 2010 à 17:06 +0800, Changli Gao a écrit :
> reimplement softnet_data.output_queue as a FIFO queue.
>
> reimplement softnet_data.output_queue as a FIFO queue to keep the fairness among
> the qdiscs rescheduled.
>
> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
> ----
> include/linux/netdevice.h | 1 +
> net/core/dev.c | 22 ++++++++++++----------
> 2 files changed, 13 insertions(+), 10 deletions(-)
> diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
> index 3c5ed5f..c04ca24 100644
> --- a/include/linux/netdevice.h
> +++ b/include/linux/netdevice.h
> @@ -1385,6 +1385,7 @@ static inline int unregister_gifconf(unsigned int family)
> */
> struct softnet_data {
> struct Qdisc *output_queue;
> + struct Qdisc **output_queue_tailp;
> struct list_head poll_list;
> struct sk_buff *completion_queue;
>
> diff --git a/net/core/dev.c b/net/core/dev.c
> index 4d43f1a..3d31491 100644
> --- a/net/core/dev.c
> +++ b/net/core/dev.c
> @@ -1557,8 +1557,9 @@ static inline void __netif_reschedule(struct Qdisc *q)
>
> local_irq_save(flags);
> sd = &__get_cpu_var(softnet_data);
> - q->next_sched = sd->output_queue;
> - sd->output_queue = q;
> + q->next_sched = NULL;
> + *sd->output_queue_tailp = q;
> + sd->output_queue_tailp = &q->next_sched;
> raise_softirq_irqoff(NET_TX_SOFTIRQ);
> local_irq_restore(flags);
> }
> @@ -2529,6 +2530,7 @@ static void net_tx_action(struct softirq_action *h)
> local_irq_disable();
> head = sd->output_queue;
> sd->output_queue = NULL;
> + sd->output_queue_tailp = &sd->output_queue;
> local_irq_enable();
>
> while (head) {
> @@ -5594,7 +5596,6 @@ static int dev_cpu_callback(struct notifier_block *nfb,
> void *ocpu)
> {
> struct sk_buff **list_skb;
> - struct Qdisc **list_net;
> struct sk_buff *skb;
> unsigned int cpu, oldcpu = (unsigned long)ocpu;
> struct softnet_data *sd, *oldsd;
> @@ -5615,13 +5616,13 @@ static int dev_cpu_callback(struct notifier_block *nfb,
> *list_skb = oldsd->completion_queue;
> oldsd->completion_queue = NULL;
>
> - /* Find end of our output_queue. */
> - list_net = &sd->output_queue;
> - while (*list_net)
> - list_net = &(*list_net)->next_sched;
> /* Append output queue from offline CPU. */
> - *list_net = oldsd->output_queue;
> - oldsd->output_queue = NULL;
> + if (oldsd->output_queue) {
> + *sd->output_queue_tailp = oldsd->output_queue;
> + sd->output_queue_tailp = oldsd->output_queue_tailp;
> + oldsd->output_queue = NULL;
> + oldsd->output_queue_tailp = &oldsd->output_queue;
> + }
>
> raise_softirq_irqoff(NET_TX_SOFTIRQ);
> local_irq_enable();
> @@ -5851,7 +5852,8 @@ static int __init net_dev_init(void)
> skb_queue_head_init(&sd->input_pkt_queue);
> sd->completion_queue = NULL;
> INIT_LIST_HEAD(&sd->poll_list);
> -
> + sd->output_queue = NULL;
> + sd->output_queue_tailp = &sd->output_queue;
> #ifdef CONFIG_RPS
> sd->csd.func = rps_trigger_softirq;
> sd->csd.info = sd;
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] net: reimplement softnet_data.output_queue as a FIFO queue
2010-04-27 20:36 ` Eric Dumazet
@ 2010-04-27 21:32 ` David Miller
0 siblings, 0 replies; 3+ messages in thread
From: David Miller @ 2010-04-27 21:32 UTC (permalink / raw)
To: eric.dumazet; +Cc: xiaosuo, netdev
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Tue, 27 Apr 2010 22:36:58 +0200
> Le mardi 27 avril 2010 à 17:06 +0800, Changli Gao a écrit :
>> reimplement softnet_data.output_queue as a FIFO queue.
>>
>> reimplement softnet_data.output_queue as a FIFO queue to keep the fairness among
>> the qdiscs rescheduled.
>>
>> Signed-off-by: Changli Gao <xiaosuo@gmail.com>
>
> Acked-by: Eric Dumazet <eric.dumazet@gmail.com>
Applied, thanks everyone.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2010-04-27 21:32 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-27 9:06 [PATCH v2] net: reimplement softnet_data.output_queue as a FIFO queue Changli Gao
2010-04-27 20:36 ` Eric Dumazet
2010-04-27 21:32 ` David Miller
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).