Commit da01ec4e authored by Li RongQing's avatar Li RongQing Committed by David S. Miller
Browse files

net: sched: do not emit messages while holding spinlock



move messages emitting out of sch_tree_lock to avoid holding
this lock too long.

Signed-off-by: default avatarLi RongQing <lirongqing@baidu.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent ec1d8ccb
Loading
Loading
Loading
Loading
+7 −4
Original line number Original line Diff line number Diff line
@@ -1337,6 +1337,7 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
	struct nlattr *tb[TCA_HTB_MAX + 1];
	struct nlattr *tb[TCA_HTB_MAX + 1];
	struct tc_htb_opt *hopt;
	struct tc_htb_opt *hopt;
	u64 rate64, ceil64;
	u64 rate64, ceil64;
	int warn = 0;


	/* extract all subattrs from opt attr */
	/* extract all subattrs from opt attr */
	if (!opt)
	if (!opt)
@@ -1499,13 +1500,11 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,
		cl->quantum = min_t(u64, quantum, INT_MAX);
		cl->quantum = min_t(u64, quantum, INT_MAX);


		if (!hopt->quantum && cl->quantum < 1000) {
		if (!hopt->quantum && cl->quantum < 1000) {
			pr_warn("HTB: quantum of class %X is small. Consider r2q change.\n",
			warn = -1;
				cl->common.classid);
			cl->quantum = 1000;
			cl->quantum = 1000;
		}
		}
		if (!hopt->quantum && cl->quantum > 200000) {
		if (!hopt->quantum && cl->quantum > 200000) {
			pr_warn("HTB: quantum of class %X is big. Consider r2q change.\n",
			warn = 1;
				cl->common.classid);
			cl->quantum = 200000;
			cl->quantum = 200000;
		}
		}
		if (hopt->quantum)
		if (hopt->quantum)
@@ -1519,6 +1518,10 @@ static int htb_change_class(struct Qdisc *sch, u32 classid,


	sch_tree_unlock(sch);
	sch_tree_unlock(sch);


	if (warn)
		pr_warn("HTB: quantum of class %X is %s. Consider r2q change.\n",
			    cl->common.classid, (warn == -1 ? "small" : "big"));

	qdisc_class_hash_grow(sch, &q->clhash);
	qdisc_class_hash_grow(sch, &q->clhash);


	*arg = (unsigned long)cl;
	*arg = (unsigned long)cl;