diff options
author | Michael S. Tsirkin <mst@redhat.com> | 2010-10-06 09:34:45 -0400 |
---|---|---|
committer | Michael S. Tsirkin <mst@redhat.com> | 2010-11-04 07:22:11 -0400 |
commit | 64e1c80748afca3b4818ebb232a9668bf529886d (patch) | |
tree | 80f0be16eaed7b4561c54e3f4a26138848b816f4 /drivers/vhost/vhost.c | |
parent | 533a19b4b88fcf81da3106b94f0ac4ac8b33a248 (diff) |
vhost-net: batch use/unuse mm
Move use/unuse mm to vhost.c which makes it possible to batch these
operations.
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Diffstat (limited to 'drivers/vhost/vhost.c')
-rw-r--r-- | drivers/vhost/vhost.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c index 9920bae6ee43..c17c881e235a 100644 --- a/drivers/vhost/vhost.c +++ b/drivers/vhost/vhost.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/vhost.h> | 15 | #include <linux/vhost.h> |
16 | #include <linux/virtio_net.h> | 16 | #include <linux/virtio_net.h> |
17 | #include <linux/mm.h> | 17 | #include <linux/mm.h> |
18 | #include <linux/mmu_context.h> | ||
18 | #include <linux/miscdevice.h> | 19 | #include <linux/miscdevice.h> |
19 | #include <linux/mutex.h> | 20 | #include <linux/mutex.h> |
20 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
@@ -177,6 +178,8 @@ static int vhost_worker(void *data) | |||
177 | struct vhost_work *work = NULL; | 178 | struct vhost_work *work = NULL; |
178 | unsigned uninitialized_var(seq); | 179 | unsigned uninitialized_var(seq); |
179 | 180 | ||
181 | use_mm(dev->mm); | ||
182 | |||
180 | for (;;) { | 183 | for (;;) { |
181 | /* mb paired w/ kthread_stop */ | 184 | /* mb paired w/ kthread_stop */ |
182 | set_current_state(TASK_INTERRUPTIBLE); | 185 | set_current_state(TASK_INTERRUPTIBLE); |
@@ -191,7 +194,7 @@ static int vhost_worker(void *data) | |||
191 | if (kthread_should_stop()) { | 194 | if (kthread_should_stop()) { |
192 | spin_unlock_irq(&dev->work_lock); | 195 | spin_unlock_irq(&dev->work_lock); |
193 | __set_current_state(TASK_RUNNING); | 196 | __set_current_state(TASK_RUNNING); |
194 | return 0; | 197 | break; |
195 | } | 198 | } |
196 | if (!list_empty(&dev->work_list)) { | 199 | if (!list_empty(&dev->work_list)) { |
197 | work = list_first_entry(&dev->work_list, | 200 | work = list_first_entry(&dev->work_list, |
@@ -209,6 +212,8 @@ static int vhost_worker(void *data) | |||
209 | schedule(); | 212 | schedule(); |
210 | 213 | ||
211 | } | 214 | } |
215 | unuse_mm(dev->mm); | ||
216 | return 0; | ||
212 | } | 217 | } |
213 | 218 | ||
214 | /* Helper to allocate iovec buffers for all vqs. */ | 219 | /* Helper to allocate iovec buffers for all vqs. */ |