| .. | .. |
|---|
| 10 | 10 | #include <linux/percpu.h> |
|---|
| 11 | 11 | #include <linux/dynamic_queue_limits.h> |
|---|
| 12 | 12 | #include <linux/list.h> |
|---|
| 13 | +#include <net/net_seq_lock.h> |
|---|
| 13 | 14 | #include <linux/refcount.h> |
|---|
| 14 | 15 | #include <linux/workqueue.h> |
|---|
| 15 | 16 | #include <net/gen_stats.h> |
|---|
| .. | .. |
|---|
| 100 | 101 | struct sk_buff_head gso_skb ____cacheline_aligned_in_smp; |
|---|
| 101 | 102 | struct qdisc_skb_head q; |
|---|
| 102 | 103 | struct gnet_stats_basic_packed bstats; |
|---|
| 103 | | - seqcount_t running; |
|---|
| 104 | + net_seqlock_t running; |
|---|
| 104 | 105 | struct gnet_stats_queue qstats; |
|---|
| 105 | 106 | unsigned long state; |
|---|
| 106 | 107 | struct Qdisc *next_sched; |
|---|
| .. | .. |
|---|
| 137 | 138 | { |
|---|
| 138 | 139 | if (qdisc->flags & TCQ_F_NOLOCK) |
|---|
| 139 | 140 | return spin_is_locked(&qdisc->seqlock); |
|---|
| 141 | +#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 142 | + return spin_is_locked(&qdisc->running.lock) ? true : false; |
|---|
| 143 | +#else |
|---|
| 140 | 144 | return (raw_read_seqcount(&qdisc->running) & 1) ? true : false; |
|---|
| 145 | +#endif |
|---|
| 141 | 146 | } |
|---|
| 142 | 147 | |
|---|
| 143 | 148 | static inline bool qdisc_run_begin(struct Qdisc *qdisc) |
|---|
| .. | .. |
|---|
| 148 | 153 | } else if (qdisc_is_running(qdisc)) { |
|---|
| 149 | 154 | return false; |
|---|
| 150 | 155 | } |
|---|
| 156 | +#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 157 | + if (try_write_seqlock(&qdisc->running)) |
|---|
| 158 | + return true; |
|---|
| 159 | + return false; |
|---|
| 160 | +#else |
|---|
| 151 | 161 | /* Variant of write_seqcount_begin() telling lockdep a trylock |
|---|
| 152 | 162 | * was attempted. |
|---|
| 153 | 163 | */ |
|---|
| 154 | 164 | raw_write_seqcount_begin(&qdisc->running); |
|---|
| 155 | 165 | seqcount_acquire(&qdisc->running.dep_map, 0, 1, _RET_IP_); |
|---|
| 156 | 166 | return true; |
|---|
| 167 | +#endif |
|---|
| 157 | 168 | } |
|---|
| 158 | 169 | |
|---|
| 159 | 170 | static inline void qdisc_run_end(struct Qdisc *qdisc) |
|---|
| 160 | 171 | { |
|---|
| 172 | +#ifdef CONFIG_PREEMPT_RT_BASE |
|---|
| 173 | + write_sequnlock(&qdisc->running); |
|---|
| 174 | +#else |
|---|
| 161 | 175 | write_seqcount_end(&qdisc->running); |
|---|
| 176 | +#endif |
|---|
| 162 | 177 | if (qdisc->flags & TCQ_F_NOLOCK) |
|---|
| 163 | 178 | spin_unlock(&qdisc->seqlock); |
|---|
| 164 | 179 | } |
|---|
| .. | .. |
|---|
| 475 | 490 | return qdisc_lock(root); |
|---|
| 476 | 491 | } |
|---|
| 477 | 492 | |
|---|
| 478 | | -static inline seqcount_t *qdisc_root_sleeping_running(const struct Qdisc *qdisc) |
|---|
| 493 | +static inline net_seqlock_t *qdisc_root_sleeping_running(const struct Qdisc *qdisc) |
|---|
| 479 | 494 | { |
|---|
| 480 | 495 | struct Qdisc *root = qdisc_root_sleeping(qdisc); |
|---|
| 481 | 496 | |
|---|