diff --git a/drivers/char/drm/drm_vm.c b/drivers/char/drm/drm_vm.c
index ef5e6b1..4501b4b 100644
--- a/drivers/char/drm/drm_vm.c
+++ b/drivers/char/drm/drm_vm.c
@@ -663,6 +663,19 @@ static int drm_mmap_locked(struct file *filp, struct vm_area_struct *vma)
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_drm(void)
+{
+	ksplice_dontexpand(&drm_vm_ops);
+	ksplice_dontexpand(&drm_vm_shm_ops);
+	ksplice_dontexpand(&drm_vm_dma_ops);
+	ksplice_dontexpand(&drm_vm_sg_ops);
+}
+ksplice_apply(ksplice_dontexpand_drm);
+
 int drm_mmap(struct file *filp, struct vm_area_struct *vma)
 {
 	struct drm_file *priv = filp->private_data;
diff --git a/drivers/char/mspec.c b/drivers/char/mspec.c
index ff146c2..2543588 100644
--- a/drivers/char/mspec.c
+++ b/drivers/char/mspec.c
@@ -291,6 +291,16 @@ mspec_mmap(struct file *file, struct vm_area_struct *vma,
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_mspec(void)
+{
+	ksplice_dontexpand(&mspec_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_mspec);
+
 static int
 fetchop_mmap(struct file *file, struct vm_area_struct *vma)
 {
diff --git a/kernel/relay.c b/kernel/relay.c
index 7c03733..7deab30 100644
--- a/kernel/relay.c
+++ b/kernel/relay.c
@@ -99,6 +99,16 @@ static int relay_mmap_buf(struct rchan_buf *buf, struct vm_area_struct *vma)
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_relay(void)
+{
+	ksplice_dontexpand(&relay_file_mmap_ops);
+}
+ksplice_apply(ksplice_dontexpand_relay);
+
 /**
  *	relay_alloc_buf - allocate a channel buffer
  *	@buf: the buffer struct
diff --git a/mm/mmap.c b/mm/mmap.c
index 8295577..3382c71 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -2231,3 +2231,40 @@ int install_special_mapping(struct mm_struct *mm,
 
 	return 0;
 }
+
+#include <ksplice-patch.h>
+
+int ksplice_mmap_check_apply(void)
+{
+	struct task_struct *g, *tsk;
+	do_each_thread(g, tsk) {
+		if (tsk->mm == NULL)
+			continue;
+		if (!down_write_trylock(&tsk->mm->mmap_sem))
+			return 1;
+		up_write(&tsk->mm->mmap_sem);
+	} while_each_thread(g, tsk);
+	return 0;
+}
+ksplice_check_apply(ksplice_mmap_check_apply);
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops)
+{
+	struct task_struct *g, *tsk;
+	do_each_thread(g, tsk) {
+		struct vm_area_struct *vma;
+		if (tsk->mm == NULL)
+			continue;
+		for (vma = tsk->mm->mmap; vma != NULL; vma = vma->vm_next) {
+			if (vma->vm_ops == vm_ops)
+				vma->vm_flags |= VM_DONTEXPAND;
+		}
+	} while_each_thread(g, tsk);
+}
+EXPORT_SYMBOL_GPL(ksplice_dontexpand);
+
+void ksplice_dontexpand_special(void)
+{
+	ksplice_dontexpand(&special_mapping_vmops);
+}
+ksplice_apply(ksplice_dontexpand_special);
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 1558a5c..3b6b5f9 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -89,6 +89,16 @@ static int snd_us428ctls_mmap(struct snd_hwdep * hw, struct file *filp, struct v
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_us428ctls(void)
+{
+	ksplice_dontexpand(&us428ctls_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_us428ctls);
+
 static unsigned int snd_us428ctls_poll(struct snd_hwdep *hw, struct file *file, poll_table *wait)
 {
 	unsigned int	mask = 0;
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c
index 117946f..e11ce41 100644
--- a/sound/usb/usx2y/usx2yhwdeppcm.c
+++ b/sound/usb/usx2y/usx2yhwdeppcm.c
@@ -727,6 +727,16 @@ static int snd_usX2Y_hwdep_pcm_mmap(struct snd_hwdep * hw, struct file *filp, st
 	return 0;
 }
 
+#include <ksplice-patch.h>
+
+void ksplice_dontexpand(struct vm_operations_struct *vm_ops);
+
+void ksplice_dontexpand_usX2Y_hwdep_pcm(void)
+{
+	ksplice_dontexpand(&snd_usX2Y_hwdep_pcm_vm_ops);
+}
+ksplice_apply(ksplice_dontexpand_usX2Y_hwdep_pcm);
+
 
 static void snd_usX2Y_hwdep_pcm_private_free(struct snd_hwdep *hwdep)
 {
