tmpfs round robin page allocation & finer grained iflib affinity ctrl
This commit is contained in:
parent
c8c2762402
commit
3a3649ec3f
@ -96,6 +96,7 @@ tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
|
|||||||
vm_object_deallocate(object);
|
vm_object_deallocate(object);
|
||||||
object = NULL;
|
object = NULL;
|
||||||
}
|
}
|
||||||
|
object->domain.dr_policy = DOMAINSET_RR();
|
||||||
return (object);
|
return (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -594,7 +594,14 @@ SYSCTL_INT(_net_iflib, OID_AUTO, timer_default, CTLFLAG_RW,
|
|||||||
#define IFLIB_CPU_OVERRIDE_MAX_SIZE (256)
|
#define IFLIB_CPU_OVERRIDE_MAX_SIZE (256)
|
||||||
static char iflib_override_cpu_bdfs[IFLIB_CPU_OVERRIDE_MAX_SIZE] = "";
|
static char iflib_override_cpu_bdfs[IFLIB_CPU_OVERRIDE_MAX_SIZE] = "";
|
||||||
SYSCTL_STRING(_net_iflib, OID_AUTO, override_cpu_bdfs, CTLFLAG_RWTUN,
|
SYSCTL_STRING(_net_iflib, OID_AUTO, override_cpu_bdfs, CTLFLAG_RWTUN,
|
||||||
iflib_override_cpu_bdfs, sizeof(iflib_override_cpu_bdfs), "a device's bdfs identifier to affinitze to all cpus");
|
iflib_override_cpu_bdfs, sizeof(iflib_override_cpu_bdfs), "a device's bdfs identifier to affinitze to a subset of cores");
|
||||||
|
#define IFLIB_CPU_LIST_MAX_SIZE (256)
|
||||||
|
static int iflib_override_cpu_base = 0;
|
||||||
|
SYSCTL_INT(_net_iflib, OID_AUTO, override_cpu_base, CTLFLAG_RWTUN,
|
||||||
|
&iflib_override_cpu_base, 0, "the base cpu for the the subset of cores");
|
||||||
|
static int iflib_override_cpu_stride = 2;
|
||||||
|
SYSCTL_INT(_net_iflib, OID_AUTO, override_cpu_stride, CTLFLAG_RWTUN,
|
||||||
|
&iflib_override_cpu_stride, 0, "the stride for the the subset of cores");
|
||||||
|
|
||||||
#if IFLIB_DEBUG_COUNTERS
|
#if IFLIB_DEBUG_COUNTERS
|
||||||
|
|
||||||
@ -5015,6 +5022,7 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
|
|||||||
kobj_method_t *kobj_method;
|
kobj_method_t *kobj_method;
|
||||||
int err, msix, rid;
|
int err, msix, rid;
|
||||||
int num_txd, num_rxd;
|
int num_txd, num_rxd;
|
||||||
|
int cpu_count;
|
||||||
unsigned int bus = pci_get_bus(dev);
|
unsigned int bus = pci_get_bus(dev);
|
||||||
unsigned int device = pci_get_slot(dev);
|
unsigned int device = pci_get_slot(dev);
|
||||||
unsigned int function = pci_get_function(dev);
|
unsigned int function = pci_get_function(dev);
|
||||||
@ -5116,15 +5124,18 @@ iflib_device_register(device_t dev, void *sc, if_shared_ctx_t sctx, if_ctx_t *ct
|
|||||||
NULL, NULL, "admin");
|
NULL, NULL, "admin");
|
||||||
|
|
||||||
if (strcmp(iflib_override_cpu_bdfs, bdf_str) == 0) {
|
if (strcmp(iflib_override_cpu_bdfs, bdf_str) == 0) {
|
||||||
cpuset_t cset;
|
CPU_ZERO(&ctx->ifc_cpus);
|
||||||
device_printf(dev, "override cpu to all cpus\n");
|
cpu_count = CPU_COUNT(&all_cpus);
|
||||||
CPU_COPY(&all_cpus, &ctx->ifc_cpus);
|
if (iflib_override_cpu_stride <= 0) {
|
||||||
CPU_ZERO(&cset);
|
device_printf(dev, "invalid cpu stride %d detected, resetting to 2\n", iflib_override_cpu_stride);
|
||||||
for (int i = 0; i < 32; i++) {
|
iflib_override_cpu_stride = 2;
|
||||||
CPU_SET(i*2, &cset);
|
|
||||||
}
|
}
|
||||||
CPU_AND(&ctx->ifc_cpus, &ctx->ifc_cpus, &cset);
|
device_printf(dev, "overriding core affinty to base %d, stride %d, total cores %d\n", iflib_override_cpu_base, iflib_override_cpu_stride, cpu_count);
|
||||||
ctx->ifc_cpus_are_physical_cores = true;
|
for (int i = iflib_override_cpu_base; i < cpu_count; i+= iflib_override_cpu_stride) {
|
||||||
|
device_printf(dev, "setting affinty to core %d\n", i);
|
||||||
|
CPU_SET(i, &ctx->ifc_cpus);
|
||||||
|
}
|
||||||
|
ctx->ifc_cpus_are_physical_cores = false;
|
||||||
}
|
}
|
||||||
/* Set up cpu set. If it fails, use the set of all CPUs. */
|
/* Set up cpu set. If it fails, use the set of all CPUs. */
|
||||||
else if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) {
|
else if (bus_get_cpus(dev, INTR_CPUS, sizeof(ctx->ifc_cpus), &ctx->ifc_cpus) != 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user