summaryrefslogtreecommitdiffstats
path: root/sys/ofed
diff options
context:
space:
mode:
authormjg <mjg@FreeBSD.org>2015-06-10 10:48:12 +0000
committermjg <mjg@FreeBSD.org>2015-06-10 10:48:12 +0000
commitd7bc9285a673d676370f95a84ce93ef553c8688c (patch)
treedbbb077ee034cbfe839c1ba19dbe5ce374a5c6a3 /sys/ofed
parent67f2eebb44e1f27017750eddaf5a5ea513cb9c71 (diff)
downloadFreeBSD-src-d7bc9285a673d676370f95a84ce93ef553c8688c.zip
FreeBSD-src-d7bc9285a673d676370f95a84ce93ef553c8688c.tar.gz
Implement lockless resource limits.
Use the same scheme implemented to manage credentials. Code needing to look at process's credentials (as opposed to thred's) is provided with *_proc variants of relevant functions. Places which possibly had to take the proc lock anyway still use the proc pointer to access limits.
Diffstat (limited to 'sys/ofed')
-rw-r--r--sys/ofed/drivers/infiniband/core/umem.c2
-rw-r--r--sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/sys/ofed/drivers/infiniband/core/umem.c b/sys/ofed/drivers/infiniband/core/umem.c
index cdd2e67..5f4465f 100644
--- a/sys/ofed/drivers/infiniband/core/umem.c
+++ b/sys/ofed/drivers/infiniband/core/umem.c
@@ -272,7 +272,7 @@ struct ib_umem *ib_umem_get_ex(struct ib_ucontext *context, unsigned long addr,
PROC_LOCK(proc);
if (ptoa(npages +
pmap_wired_count(vm_map_pmap(&proc->p_vmspace->vm_map))) >
- lim_cur(proc, RLIMIT_MEMLOCK)) {
+ lim_cur_proc(proc, RLIMIT_MEMLOCK)) {
PROC_UNLOCK(proc);
kfree(umem);
return ERR_PTR(-ENOMEM);
diff --git a/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c b/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c
index 0cdebaf..ad5818e 100644
--- a/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c
+++ b/sys/ofed/drivers/infiniband/hw/mthca/mthca_memfree.c
@@ -553,7 +553,8 @@ out:
proc = curproc;
pmap = vm_map_pmap(&proc->p_vmspace->vm_map);
PROC_LOCK(proc);
- if (ptoa(pmap_wired_count(pmap) + 1) > lim_cur(proc, RLIMIT_MEMLOCK)) {
+ if (ptoa(pmap_wired_count(pmap) + 1) >
+ lim_cur_proc(proc, RLIMIT_MEMLOCK)) {
PROC_UNLOCK(proc);
ret = -ENOMEM;
goto out;
OpenPOWER on IntegriCloud