tmpfs NUMA and iflib drew's fix

This commit is contained in:
quackerd 2022-12-09 09:19:19 +01:00
parent 111610316e
commit ad7cd9cebe
2 changed files with 48 additions and 0 deletions

View File

@ -74,6 +74,19 @@ __FBSDID("$FreeBSD$");
SYSCTL_NODE(_vfs, OID_AUTO, tmpfs, CTLFLAG_RW | CTLFLAG_MPSAFE, 0,
"tmpfs file system");
#define VM_DOMAIN_POLICY_NONE (0)
#define VM_DOMAIN_POLICY_RR (1)
#define VM_DOMAIN_POLICY_IL (2)
#define VM_DOMAIN_POLICY_FIXED (3)
#define VM_DOMAIN_POLICY_PREF (4)
static int vm_domain_policy = 0;
SYSCTL_INT(_vfs_tmpfs, OID_AUTO, domain_policy, CTLFLAG_RWTUN,
&vm_domain_policy, 0, "domain policy for the underlying vmobject. 0: None; 1: RR; 2: IL; 3: FIXED; 4: PREF");
static int vm_domain_target = 0;
SYSCTL_INT(_vfs_tmpfs, OID_AUTO, domain_target, CTLFLAG_RWTUN,
&vm_domain_target, 0, "target domain for the policy. only appicable to FIXED and PREF.");
static long tmpfs_pages_reserved = TMPFS_PAGES_MINRESERVED;
MALLOC_DEFINE(M_TMPFSDIR, "tmpfs dir", "tmpfs dirent structure");
@ -82,6 +95,37 @@ VFS_SMR_DECLARE;
int tmpfs_pager_type = -1;
static struct domainset *
tmpfs_get_domainset(void)
{
struct domainset * vm_domainset = NULL;
switch (vm_domain_policy) {
case VM_DOMAIN_POLICY_RR:
vm_domainset = DOMAINSET_RR();
printf("tmpfs domain policy: RR\n");
break;
case VM_DOMAIN_POLICY_IL:
vm_domainset = DOMAINSET_IL();
printf("tmpfs domain policy: IL\n");
break;
case VM_DOMAIN_POLICY_PREF:
vm_domainset = DOMAINSET_PREF(vm_domain_target);
printf("tmpfs domain policy: PREF, target: %d\n", vm_domain_target);
break;
case VM_DOMAIN_POLICY_FIXED:
vm_domainset = DOMAINSET_FIXED(vm_domain_target);
printf("tmpfs domain policy: FIXED, target: %d\n", vm_domain_target);
break;
case VM_DOMAIN_POLICY_NONE:
printf("tmpfs domain policy: NONE\n");
break;
default:
printf("unknown tmpfs domain policy: %d, defaulting to NONE\n", vm_domain_policy);
break;
}
return vm_domainset;
}
static vm_object_t
tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
vm_ooffset_t offset, struct ucred *cred)
@ -96,6 +140,7 @@ tmpfs_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot,
vm_object_deallocate(object);
object = NULL;
}
object->domain.dr_policy = tmpfs_get_domainset();
return (object);
}

View File

@ -2875,6 +2875,9 @@ iflib_rxd_pkt_get(iflib_rxq_t rxq, if_rxd_info_t ri)
}
m->m_pkthdr.len = ri->iri_len;
m->m_pkthdr.rcvif = ri->iri_ifp;
#ifdef NUMA
m->m_pkthdr.numa_domain = ri->iri_ifp->if_numa_domain;
#endif
m->m_flags |= ri->iri_flags;
m->m_pkthdr.ether_vtag = ri->iri_vtag;
m->m_pkthdr.flowid = ri->iri_flowid;