summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Gray <jsg@cvs.openbsd.org>2019-12-26 13:36:17 +0000
committerJonathan Gray <jsg@cvs.openbsd.org>2019-12-26 13:36:17 +0000
commit72a53026d8d0990f51ef89004c29ceb98e79d7cc (patch)
tree206dc26165cde1f531283a1349a8295f67ee22ff
parentf46490e5c95e499bc6d17a0429ce405fcfc32410 (diff)
implement unregister_shrinker()
ok kettenis@
-rw-r--r--sys/dev/pci/drm/drm_linux.c8
-rw-r--r--sys/dev/pci/drm/i915/i915_gem_shrinker.c3
-rw-r--r--sys/dev/pci/drm/include/linux/shrinker.h1
-rw-r--r--sys/dev/pci/drm/ttm/ttm_page_alloc.c2
4 files changed, 9 insertions, 5 deletions
diff --git a/sys/dev/pci/drm/drm_linux.c b/sys/dev/pci/drm/drm_linux.c
index 1fb37929613..6f262875c3b 100644
--- a/sys/dev/pci/drm/drm_linux.c
+++ b/sys/dev/pci/drm/drm_linux.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: drm_linux.c,v 1.52 2019/12/25 11:31:41 kettenis Exp $ */
+/* $OpenBSD: drm_linux.c,v 1.53 2019/12/26 13:36:15 jsg Exp $ */
/*
* Copyright (c) 2013 Jonathan Gray <jsg@openbsd.org>
* Copyright (c) 2015, 2016 Mark Kettenis <kettenis@openbsd.org>
@@ -1878,6 +1878,12 @@ register_shrinker(struct shrinker *shrinker)
}
void
+unregister_shrinker(struct shrinker *shrinker)
+{
+ TAILQ_REMOVE(&shrinkers, shrinker, next);
+}
+
+void
drmbackoff(long npages)
{
struct shrink_control sc;
diff --git a/sys/dev/pci/drm/i915/i915_gem_shrinker.c b/sys/dev/pci/drm/i915/i915_gem_shrinker.c
index 8bac088399d..ff1d41c6480 100644
--- a/sys/dev/pci/drm/i915/i915_gem_shrinker.c
+++ b/sys/dev/pci/drm/i915/i915_gem_shrinker.c
@@ -530,12 +530,11 @@ void i915_gem_shrinker_register(struct drm_i915_private *i915)
*/
void i915_gem_shrinker_unregister(struct drm_i915_private *i915)
{
- STUB();
#ifdef notyet
WARN_ON(unregister_vmap_purge_notifier(&i915->mm.vmap_notifier));
WARN_ON(unregister_oom_notifier(&i915->mm.oom_notifier));
- unregister_shrinker(&i915->mm.shrinker);
#endif
+ unregister_shrinker(&i915->mm.shrinker);
}
void i915_gem_shrinker_taints_mutex(struct rwlock *mutex)
diff --git a/sys/dev/pci/drm/include/linux/shrinker.h b/sys/dev/pci/drm/include/linux/shrinker.h
index 12d36810d46..62272dc11dc 100644
--- a/sys/dev/pci/drm/include/linux/shrinker.h
+++ b/sys/dev/pci/drm/include/linux/shrinker.h
@@ -21,5 +21,6 @@ struct shrinker {
#define DEFAULT_SEEKS 2
int register_shrinker(struct shrinker *);
+void unregister_shrinker(struct shrinker *);
#endif
diff --git a/sys/dev/pci/drm/ttm/ttm_page_alloc.c b/sys/dev/pci/drm/ttm/ttm_page_alloc.c
index 5666163906c..42824de13f5 100644
--- a/sys/dev/pci/drm/ttm/ttm_page_alloc.c
+++ b/sys/dev/pci/drm/ttm/ttm_page_alloc.c
@@ -449,9 +449,7 @@ static int ttm_pool_mm_shrink_init(struct ttm_pool_manager *manager)
static void ttm_pool_mm_shrink_fini(struct ttm_pool_manager *manager)
{
-#ifdef notyet
unregister_shrinker(&manager->mm_shrink);
-#endif
}
static int ttm_set_pages_caching(struct vm_page **pages,