mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-09 06:33:34 +00:00
Merge branch 'net-sched-fixes-after-recent-qdisc-running-changes'
Eric Dumazet says: ==================== net: sched: fixes after recent qdisc->running changes First patch fixes a plain bug in qdisc_run_begin(). Second patch removes a pair of atomic operations, increasing performance. ==================== Link: https://lore.kernel.org/r/20211019003402.2110017-1-eric.dumazet@gmail.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
commit
816219a86d
@ -38,10 +38,13 @@ enum qdisc_state_t {
|
||||
__QDISC_STATE_DEACTIVATED,
|
||||
__QDISC_STATE_MISSED,
|
||||
__QDISC_STATE_DRAINING,
|
||||
};
|
||||
|
||||
enum qdisc_state2_t {
|
||||
/* Only for !TCQ_F_NOLOCK qdisc. Never access it directly.
|
||||
* Use qdisc_run_begin/end() or qdisc_is_running() instead.
|
||||
*/
|
||||
__QDISC_STATE_RUNNING,
|
||||
__QDISC_STATE2_RUNNING,
|
||||
};
|
||||
|
||||
#define QDISC_STATE_MISSED BIT(__QDISC_STATE_MISSED)
|
||||
@ -114,6 +117,7 @@ struct Qdisc {
|
||||
struct gnet_stats_basic_sync bstats;
|
||||
struct gnet_stats_queue qstats;
|
||||
unsigned long state;
|
||||
unsigned long state2; /* must be written under qdisc spinlock */
|
||||
struct Qdisc *next_sched;
|
||||
struct sk_buff_head skb_bad_txq;
|
||||
|
||||
@ -154,7 +158,7 @@ static inline bool qdisc_is_running(struct Qdisc *qdisc)
|
||||
{
|
||||
if (qdisc->flags & TCQ_F_NOLOCK)
|
||||
return spin_is_locked(&qdisc->seqlock);
|
||||
return test_bit(__QDISC_STATE_RUNNING, &qdisc->state);
|
||||
return test_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
|
||||
}
|
||||
|
||||
static inline bool nolock_qdisc_is_empty(const struct Qdisc *qdisc)
|
||||
@ -217,7 +221,7 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
|
||||
*/
|
||||
return spin_trylock(&qdisc->seqlock);
|
||||
}
|
||||
return test_and_set_bit(__QDISC_STATE_RUNNING, &qdisc->state);
|
||||
return !__test_and_set_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
|
||||
}
|
||||
|
||||
static inline void qdisc_run_end(struct Qdisc *qdisc)
|
||||
@ -229,7 +233,7 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
|
||||
&qdisc->state)))
|
||||
__netif_schedule(qdisc);
|
||||
} else {
|
||||
clear_bit(__QDISC_STATE_RUNNING, &qdisc->state);
|
||||
__clear_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user