compat 5.8+: adapt to kthread_use_mm

This commit is contained in:
Thomas Schoebel-Theuer 2021-08-17 08:28:24 +02:00
parent b0a5594693
commit 248d1d0342
2 changed files with 15 additions and 0 deletions

View File

@ -256,6 +256,13 @@ extern int __oldcompat_unlink(
#include <linux/sched/mm.h>
#endif
/* Adapt to f5678e7f2ac31c270334b936352f0ef2fe7dd2b3
* via 14c3656b7284a8649496584869e8c6642ec1abbb
*/
#ifdef MMAP_LOCK_INITIALIZER
#define MARS_USE_kthread_use_mm
#endif
/* for networking */
#include <net/sock.h>

View File

@ -546,7 +546,11 @@ static inline void use_fake_mm(void)
if (!current->mm && mm_fake) {
atomic_inc(&mm_fake_count);
MARS_DBG("using fake, count=%d\n", atomic_read(&mm_fake_count));
#ifdef MARS_USE_kthread_use_mm
kthread_use_mm(mm_fake);
#else
use_mm(mm_fake);
#endif
}
}
@ -557,8 +561,12 @@ static inline void unuse_fake_mm(void)
if (current->mm == mm_fake && mm_fake) {
MARS_DBG("unusing fake, count=%d\n", atomic_read(&mm_fake_count));
atomic_dec(&mm_fake_count);
#ifdef MARS_USE_kthread_use_mm
kthread_unuse_mm(mm_fake);
#else
unuse_mm(mm_fake);
current->mm = NULL;
#endif
}
}