mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/herbert/cryptodev-2.6.git
synced 2026-04-18 03:23:53 -04:00
net: sched: claim one cache line in Qdisc
Replace state2 field with a boolean. Move it to a hole between qstats and state so that we shrink Qdisc by a full cache line. Signed-off-by: Eric Dumazet <edumazet@google.com> Reviewed-by: Kuniyuki Iwashima <kuniyu@google.com> Reviewed-by: Toke Høiland-Jørgensen <toke@redhat.com> Tested-by: Jamal Hadi Salim <jhs@mojatatu.com> Acked-by: Jamal Hadi Salim <jhs@mojatatu.com> Link: https://patch.msgid.link/20251014171907.3554413-6-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
178ca30889
commit
526f5fb112
@@ -41,13 +41,6 @@ enum qdisc_state_t {
|
||||
__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_STATE2_RUNNING,
|
||||
};
|
||||
|
||||
#define QDISC_STATE_MISSED BIT(__QDISC_STATE_MISSED)
|
||||
#define QDISC_STATE_DRAINING BIT(__QDISC_STATE_DRAINING)
|
||||
|
||||
@@ -117,8 +110,8 @@ struct Qdisc {
|
||||
struct qdisc_skb_head q;
|
||||
struct gnet_stats_basic_sync bstats;
|
||||
struct gnet_stats_queue qstats;
|
||||
bool running; /* must be written under qdisc spinlock */
|
||||
unsigned long state;
|
||||
unsigned long state2; /* must be written under qdisc spinlock */
|
||||
struct Qdisc *next_sched;
|
||||
struct sk_buff_head skb_bad_txq;
|
||||
|
||||
@@ -167,7 +160,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_STATE2_RUNNING, &qdisc->state2);
|
||||
return READ_ONCE(qdisc->running);
|
||||
}
|
||||
|
||||
static inline bool nolock_qdisc_is_empty(const struct Qdisc *qdisc)
|
||||
@@ -210,7 +203,10 @@ static inline bool qdisc_run_begin(struct Qdisc *qdisc)
|
||||
*/
|
||||
return spin_trylock(&qdisc->seqlock);
|
||||
}
|
||||
return !__test_and_set_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
|
||||
if (READ_ONCE(qdisc->running))
|
||||
return false;
|
||||
WRITE_ONCE(qdisc->running, true);
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline void qdisc_run_end(struct Qdisc *qdisc)
|
||||
@@ -228,7 +224,7 @@ static inline void qdisc_run_end(struct Qdisc *qdisc)
|
||||
&qdisc->state)))
|
||||
__netif_schedule(qdisc);
|
||||
} else {
|
||||
__clear_bit(__QDISC_STATE2_RUNNING, &qdisc->state2);
|
||||
WRITE_ONCE(qdisc->running, false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user