summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntti Hatala <ahatala@nvidia.com>2010-04-20 08:10:05 -0700
committerGary King <gking@nvidia.com>2010-04-20 14:12:12 -0700
commit7085b74b8974dac8ac2c2e958f0098970d9b43ec (patch)
tree8a83ed2cb50e16f3a40419d593dfe6f9ce01d566
parent18e28a34a902ba67ff7bd29c65722e270c8cd01d (diff)
nvmap: relax iovmm over-commit check for kernel client
Change-Id: Ia2b5576672ad65e0cf730ca1a243c2efddbea906 Reviewed-on: http://git-master/r/1162 Reviewed-by: Antti Hatala <ahatala@nvidia.com> Tested-by: Antti Hatala <ahatala@nvidia.com>
-rw-r--r--drivers/char/nvmap.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/drivers/char/nvmap.c b/drivers/char/nvmap.c
index e9a38e670f18..f6d8bda77398 100644
--- a/drivers/char/nvmap.c
+++ b/drivers/char/nvmap.c
@@ -2012,6 +2012,9 @@ static int _nvmap_do_create(struct nvmap_file_priv *priv,
r = _nvmap_ref_lookup_locked(priv, (unsigned long)h);
spin_unlock(&priv->ref_lock);
if (r) {
+ /* if the client does something strange, like calling CreateFromId
+ * when it was the original creator, avoid creating two handle refs
+ * for the same handle */
atomic_inc(&r->refs);
*ref = r;
return 0;
@@ -2019,14 +2022,15 @@ static int _nvmap_do_create(struct nvmap_file_priv *priv,
/* verify that adding this handle to the process' access list
* won't exceed the IOVM limit */
- if (h->heap_pgalloc && !h->pgalloc.contig) {
+ /* TODO: [ahatala 2010-04-20] let the kernel over-commit for now */
+ if (h->heap_pgalloc && !h->pgalloc.contig && !su) {
int oc = atomic_add_return(h->size, &priv->iovm_commit);
if (oc > priv->iovm_limit) {
atomic_sub(h->size, &priv->iovm_commit);
_nvmap_handle_put(h);
h = NULL;
pr_err("%s: %s duplicating handle would "
- "over-commit iovmm space (%d / %dB\n",
+ "over-commit iovmm space (%dB / %dB)\n",
__func__, current->group_leader->comm,
oc, priv->iovm_limit);
return -ENOMEM;
@@ -2042,9 +2046,6 @@ static int _nvmap_do_create(struct nvmap_file_priv *priv,
BUG_ON(!h);
- /* if the client does something strange, like calling CreateFromId
- * when it was the original creator, avoid creating two handle refs
- * for the same handle */
spin_lock(&priv->ref_lock);
r = kzalloc(sizeof(*r), GFP_KERNEL);
if (!r) {