summaryrefslogtreecommitdiff
path: root/linux-core/drm_vm.c
diff options
context:
space:
mode:
authorThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-17 19:40:57 +0200
committerThomas Hellstrom <thomas-at-tungstengraphics-dot-com>2006-10-17 19:40:57 +0200
commitd515936ea7f98f6aaa9217699796beadef9d664b (patch)
tree78d2f0abf4f8c16e53a47c561a535903d72596af /linux-core/drm_vm.c
parent5443dbe35f182b9286a96d24d29037d5cb625e3d (diff)
Add memory usage accounting to avoid DOS problems.
Diffstat (limited to 'linux-core/drm_vm.c')
-rw-r--r--linux-core/drm_vm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/linux-core/drm_vm.c b/linux-core/drm_vm.c
index 091b43f7..1654236d 100644
--- a/linux-core/drm_vm.c
+++ b/linux-core/drm_vm.c
@@ -202,13 +202,13 @@ struct page *drm_vm_ttm_fault(struct vm_area_struct *vma,
page = ttm->pages[page_offset];
if (!page) {
- if (bm->cur_pages >= bm->max_pages) {
- DRM_ERROR("Maximum locked page count exceeded\n");
+ if (drm_alloc_memctl(PAGE_SIZE)) {
data->type = VM_FAULT_OOM;
goto out;
}
page = ttm->pages[page_offset] = drm_alloc_gatt_pages(0);
if (!page) {
+ drm_free_memctl(PAGE_SIZE);
data->type = VM_FAULT_OOM;
goto out;
}
@@ -654,7 +654,7 @@ static void drm_vm_ttm_close(struct vm_area_struct *vma)
if (ttm->destroy) {
ret = drm_destroy_ttm(ttm);
BUG_ON(ret);
- drm_free(map, sizeof(*map), DRM_MEM_TTM);
+ drm_ctl_free(map, sizeof(*map), DRM_MEM_TTM);
}
}
mutex_unlock(&dev->struct_mutex);