Skip to contentSkip to conversation

vhost: copy_from_user -> __copy_from_user

PATCH In review Michael S. Tsirkin 2 participants 5 messages Mar 6, 2011 – Mar 7, 2011

Subsystems (5)
lore
Share & tools
lore

Michael S. Tsirkin

author maintainer
#0 lore raw

PATCH 1/1 vhost: copy_from_user -> __copy_from_user

copy_from_user is pretty high on perf top profile, replacing it with __copy_from_user helps.
It's also safe because we do access_ok checks during setup.

---
 drivers/vhost/vhost.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/vhost/vhost.c +1 -1
index ade0568..01701b8 100644
@@ -1153,7 +1153,7 @@ int vhost_get_vq_desc(struct vhost_dev *dev, struct vhost_virtqueue *vq,
 			       i, vq->num, head);
 			return -EINVAL;
 		}
-		ret = copy_from_user(&desc, vq->desc + i, sizeof desc);
+		ret = __copy_from_user(&desc, vq->desc + i, sizeof desc);
 		if (unlikely(ret)) {
 			vq_err(vq, "Failed to get descriptor: idx %d addr %p\n",
 			       i, vq->desc + i);
Signature · 1 line
1.7.3.2.91.g446ac
maintainer
#1 lore raw

From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Mar 2011 13:33:49 +0200

Quoted 5 lines

copy_from_user is pretty high on perf top profile, replacing it with __copy_from_user helps.
It's also safe because we do access_ok checks during setup.

Is Rusty going to take this or should I?

author maintainer
#2 lore raw
Quoted 10 lines · David Miller

From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Mar 2011 13:33:49 +0200

Quoted 5 lines

copy_from_user is pretty high on perf top profile, replacing it with __copy_from_user helps.
It's also safe because we do access_ok checks during setup.

Is Rusty going to take this or should I?

Sorry about not making this clear. I'll give it a day or two for review then put it on the vhost tree myself.
Thanks!

author maintainer
#3 lore raw
In reply to David Miller
Quoted 10 lines · David Miller

From: "Michael S. Tsirkin" <[email protected]>
Date: Sun, 6 Mar 2011 13:33:49 +0200

Quoted 5 lines

copy_from_user is pretty high on perf top profile, replacing it with __copy_from_user helps.
It's also safe because we do access_ok checks during setup.

Is Rusty going to take this or should I?

Sorry about not making this clear. I'll give it a day or two for review then put it on the vhost tree myself.
Thanks!