From 5a60e13d0cba5df406d74d6639cc6b58dd24d350 Mon Sep 17 00:00:00 2001 From: Glauber Costa <glommer@cloudius-systems.com> Date: Sat, 11 Jan 2014 01:22:17 +0400 Subject: [PATCH] reclaim: export address of the OSV reclaimer ZFS will perform some checks to determine if the current calling "process" is the reclaimer. Export the address of the reclaimer thread so that test can work. Signed-off-by: Glauber Costa <glommer@cloudius-systems.com> Signed-off-by: Pekka Enberg <penberg@cloudius-systems.com> --- bsd/porting/kthread.h | 3 +++ core/mempool.cc | 2 ++ 2 files changed, 5 insertions(+) diff --git a/bsd/porting/kthread.h b/bsd/porting/kthread.h index 3c19b7d39..56d60eb9b 100644 --- a/bsd/porting/kthread.h +++ b/bsd/porting/kthread.h @@ -30,6 +30,9 @@ __END_DECLS #define curproc (get_curproc()) +extern unsigned char *osv_reclaimer_thread; +#define pageproc ((struct proc *)osv_reclaimer_thread) + #endif #endif diff --git a/core/mempool.cc b/core/mempool.cc index 466de98bd..9e5d47353 100644 --- a/core/mempool.cc +++ b/core/mempool.cc @@ -40,6 +40,7 @@ TRACEPOINT(trace_memory_huge_failure, "page ranges=%d", unsigned long); TRACEPOINT(trace_memory_reclaim, "shrinker %s, target=%d, delta=%d", const char *, long, long); bool smp_allocator = false; +unsigned char *osv_reclaimer_thread; namespace memory { @@ -615,6 +616,7 @@ reclaimer::reclaimer() // std::thread is implemented ontop of pthreads, so it is fine std::thread tmp([&] { _thread = sched::thread::current(); + osv_reclaimer_thread = reinterpret_cast<unsigned char *>(_thread); allow_emergency_alloc = true; do { _do_reclaim(); -- GitLab