Skip to content

Commit

Permalink
A bit of renaming in preparation for Gen3 load balancing
Browse files Browse the repository at this point in the history
  • Loading branch information
johnousterhout committed Oct 31, 2023
1 parent f79935e commit 6460571
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 21 deletions.
23 changes: 10 additions & 13 deletions homa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -1948,7 +1948,7 @@ struct homa {
* core for SoftIRQ (deprecated).
* HOMA_GRO_NEXT Always use the next core in circular
* order for SoftIRQ (deprecated).
* HOMA_GRO_IDLE_NEW Use the new mechanism for selecting an
* HOMA_GRO_GEN2 Use the new mechanism for selecting an
* idle core for SoftIRQ.
* HOMA_GRO_FAST_GRANTS Pass all grant I can see immediately to
* homa_softirq during GRO.
Expand All @@ -1959,25 +1959,22 @@ struct homa {
#define HOMA_GRO_SAME_CORE 2
#define HOMA_GRO_IDLE 4
#define HOMA_GRO_NEXT 8
#define HOMA_GRO_IDLE_NEW 16
#define HOMA_GRO_GEN2 16
#define HOMA_GRO_FAST_GRANTS 32
#define HOMA_GRO_SHORT_BYPASS 64
#define HOMA_GRO_NORMAL (HOMA_GRO_SAME_CORE|HOMA_GRO_IDLE_NEW \
#define HOMA_GRO_NORMAL (HOMA_GRO_SAME_CORE|HOMA_GRO_GEN2 \
|HOMA_GRO_SHORT_BYPASS)

/*
* @gro_busy_usecs: try not to schedule SoftIRQ processing on a core
* if it has handled Homa packets at GRO level in the last
* gro_busy_us microseconds (improve load balancing by avoiding
* hot spots). Set externally via sysctl.
* @busy_usecs: if there has been activity on a core within the
* last @busy_usecs, it is considered to be busy and Homa will
* try to avoid scheduling other activities on the core. Set
* externally via sysctl.
*/
int gro_busy_usecs;
int busy_usecs;

/**
* @gro_busy_cycles: Same as gro_busy_usecs, except in units
* of get_cycles().
*/
int gro_busy_cycles;
/** @busy_cycles: Same as busy_usecs except in get_cycles() units. */
int busy_cycles;

/**
* @timer_ticks: number of times that homa_timer has been invoked
Expand Down
4 changes: 2 additions & 2 deletions homa_incoming.c
Original file line number Diff line number Diff line change
Expand Up @@ -1886,9 +1886,9 @@ void homa_incoming_sysctl_changed(struct homa *homa)
tmp = (tmp*cpu_khz)/1000;
homa->poll_cycles = tmp;

tmp = homa->gro_busy_usecs;
tmp = homa->busy_usecs;
tmp = (tmp*cpu_khz)/1000;
homa->gro_busy_cycles = tmp;
homa->busy_cycles = tmp;

tmp = homa->bpage_lease_usecs;
tmp = (tmp*cpu_khz)/1000;
Expand Down
4 changes: 2 additions & 2 deletions homa_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ int homa_gro_complete(struct sk_buff *skb, int hoffset)
// NAPI_GRO_CB(skb)->count);

#define CORES_TO_CHECK 4
if (homa->gro_policy & HOMA_GRO_IDLE_NEW) {
if (homa->gro_policy & HOMA_GRO_GEN2) {
/* Pick a specific core to handle SoftIRQ processing for this
* group of packets. This policy scans the next several cores
* in order after this, trying to find one that is not
Expand All @@ -333,7 +333,7 @@ int homa_gro_complete(struct sk_buff *skb, int hoffset)
core = homa_cores[candidate];
if (atomic_read(&core->softirq_backlog) > 0)
continue;
if ((core->last_gro + homa->gro_busy_cycles) > now)
if ((core->last_gro + homa->busy_cycles) > now)
continue;
tt_record3("homa_gro_complete chose core %d for id %d "
"offset %d with IDLE_NEW policy",
Expand Down
2 changes: 1 addition & 1 deletion homa_plumbing.c
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ static struct ctl_table homa_ctl_table[] = {
},
{
.procname = "gro_busy_us",
.data = &homa_data.gro_busy_usecs,
.data = &homa_data.busy_usecs,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = homa_dointvec
Expand Down
2 changes: 1 addition & 1 deletion homa_utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ int homa_init(struct homa *homa)
homa->max_gro_skbs = 20;
homa->gso_force_software = 0;
homa->gro_policy = HOMA_GRO_NORMAL;
homa->gro_busy_usecs = 10;
homa->busy_usecs = 10;
homa->timer_ticks = 0;
spin_lock_init(&homa->metrics_lock);
homa->metrics = NULL;
Expand Down
4 changes: 2 additions & 2 deletions test/unit_homa_offload.c
Original file line number Diff line number Diff line change
Expand Up @@ -302,9 +302,9 @@ TEST_F(homa_offload, homa_gro_receive__max_gro_skbs)

TEST_F(homa_offload, homa_gro_complete__GRO_IDLE_NEW)
{
homa->gro_policy = HOMA_GRO_IDLE_NEW;
homa->gro_policy = HOMA_GRO_GEN2;
mock_cycles = 1000;
homa->gro_busy_cycles = 100;
homa->busy_cycles = 100;
cpu_number = 5;
atomic_set(&homa_cores[6]->softirq_backlog, 1);
homa_cores[6]->last_gro = 0;
Expand Down

0 comments on commit 6460571

Please sign in to comment.