Commit e69f73bf authored by David S. Miller's avatar David S. Miller
Browse files

Merge branch 'remove-qdisc-throttle'



Eric Dumazet says:

====================
net_sched: remove qdisc_is_throttled()

HTB, CBQ and HFSC pay a very high cost updating the qdisc 'throttled'
status that nothing but CBQ seems to use.

CBQ usage is flaky anyway, since no qdisc ->enqueue() updates the
'throttled' qdisc status.

This looks like some 'optimization' that actually cost more than code
without the optimization, and might cause latency issues with CBQ.

In my tests, I could achieve a 8 % performance increase in TCP_RR
workload through HTB qdisc, in presence of throttled classes,
and 5 % without throttled classes.
====================

Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parents 7a04c012 45f50bed
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -67,12 +67,12 @@ struct qdisc_watchdog {
};

void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc);
void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires, bool throttle);
void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires);

static inline void qdisc_watchdog_schedule(struct qdisc_watchdog *wd,
					   psched_time_t expires)
{
	qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires), true);
	qdisc_watchdog_schedule_ns(wd, PSCHED_TICKS2NS(expires));
}

void qdisc_watchdog_cancel(struct qdisc_watchdog *wd);
+0 −16
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@ struct qdisc_rate_table {
enum qdisc_state_t {
	__QDISC_STATE_SCHED,
	__QDISC_STATE_DEACTIVATED,
	__QDISC_STATE_THROTTLED,
};

struct qdisc_size_table {
@@ -125,21 +124,6 @@ static inline int qdisc_avail_bulklimit(const struct netdev_queue *txq)
#endif
}

static inline bool qdisc_is_throttled(const struct Qdisc *qdisc)
{
	return test_bit(__QDISC_STATE_THROTTLED, &qdisc->state) ? true : false;
}

static inline void qdisc_throttled(struct Qdisc *qdisc)
{
	set_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
}

static inline void qdisc_unthrottled(struct Qdisc *qdisc)
{
	clear_bit(__QDISC_STATE_THROTTLED, &qdisc->state);
}

struct Qdisc_class_ops {
	/* Child qdisc manipulation */
	struct netdev_queue *	(*select_queue)(struct Qdisc *, struct tcmsg *);
+1 −6
Original line number Diff line number Diff line
@@ -583,7 +583,6 @@ static enum hrtimer_restart qdisc_watchdog(struct hrtimer *timer)
						 timer);

	rcu_read_lock();
	qdisc_unthrottled(wd->qdisc);
	__netif_schedule(qdisc_root(wd->qdisc));
	rcu_read_unlock();

@@ -598,15 +597,12 @@ void qdisc_watchdog_init(struct qdisc_watchdog *wd, struct Qdisc *qdisc)
}
EXPORT_SYMBOL(qdisc_watchdog_init);

void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires, bool throttle)
void qdisc_watchdog_schedule_ns(struct qdisc_watchdog *wd, u64 expires)
{
	if (test_bit(__QDISC_STATE_DEACTIVATED,
		     &qdisc_root_sleeping(wd->qdisc)->state))
		return;

	if (throttle)
		qdisc_throttled(wd->qdisc);

	if (wd->last_expires == expires)
		return;

@@ -620,7 +616,6 @@ EXPORT_SYMBOL(qdisc_watchdog_schedule_ns);
void qdisc_watchdog_cancel(struct qdisc_watchdog *wd)
{
	hrtimer_cancel(&wd->timer);
	qdisc_unthrottled(wd->qdisc);
}
EXPORT_SYMBOL(qdisc_watchdog_cancel);

+1 −3
Original line number Diff line number Diff line
@@ -345,7 +345,7 @@ cbq_mark_toplevel(struct cbq_sched_data *q, struct cbq_class *cl)
{
	int toplevel = q->toplevel;

	if (toplevel > cl->level && !(qdisc_is_throttled(cl->q))) {
	if (toplevel > cl->level) {
		psched_time_t now = psched_get_time();

		do {
@@ -513,7 +513,6 @@ static enum hrtimer_restart cbq_undelay(struct hrtimer *timer)
		hrtimer_start(&q->delay_timer, time, HRTIMER_MODE_ABS_PINNED);
	}

	qdisc_unthrottled(sch);
	__netif_schedule(qdisc_root(sch));
	return HRTIMER_NORESTART;
}
@@ -819,7 +818,6 @@ cbq_dequeue(struct Qdisc *sch)
		if (skb) {
			qdisc_bstats_update(sch, skb);
			sch->q.qlen--;
			qdisc_unthrottled(sch);
			return skb;
		}

+1 −2
Original line number Diff line number Diff line
@@ -445,8 +445,7 @@ begin:
		if (!head->first) {
			if (q->time_next_delayed_flow != ~0ULL)
				qdisc_watchdog_schedule_ns(&q->watchdog,
							   q->time_next_delayed_flow,
							   false);
							   q->time_next_delayed_flow);
			return NULL;
		}
	}
Loading