virtio-blk: Avoid zeroing every request structure

The VirtIOBlockRequest structure is about 40 KB in size.  This patch
avoids zeroing every request by only initializing fields that are read.
The other fields are either written to or may not be used at all.

Oprofile shows about 10% of CPU samples in memset called by
virtio_blk_alloc_request().  The workload is
dd if=/dev/vda of=/dev/null iflag=direct bs=8k running concurrently 4
times.  This patch makes memset disappear to the bottom of the profile.

Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
1 file changed
tree: a968fe7b04f590a3ad082f323b52f00b3d83e475
  1. audio/
  2. block/
  3. bsd-user/
  4. darwin-user/
  5. default-configs/
  6. docs/
  7. fpu/
  8. fsdev/
  9. gdb-xml/
  10. hw/
  11. linux-user/
  12. net/
  13. pc-bios/
  14. QMP/
  15. roms/
  16. slirp/
  17. sysconfigs/
  18. target-alpha/
  19. target-arm/
  20. target-cris/
  21. target-i386/
  22. target-m68k/
  23. target-microblaze/
  24. target-mips/
  25. target-ppc/
  26. target-s390x/
  27. target-sh4/
  28. target-sparc/
  29. tcg/
  30. tests/
  31. .gitignore
  32. .gitmodules
  33. a.out.h
  34. acl.c
  35. acl.h
  36. aes.c
  37. aes.h
  38. aio.c
  39. alpha-dis.c
  40. alpha.ld
  41. arch_init.c
  42. arch_init.h
  43. arm-dis.c
  44. arm-semi.c
  45. arm.ld
  46. async.c
  47. balloon.c
  48. balloon.h
  49. block-migration.c
  50. block-migration.h
  51. block.c
  52. block.h
  53. block_int.h
  54. bswap.h
  55. bt-host.c
  56. bt-host.h
  57. bt-vhci.c
  58. buffered_file.c
  59. buffered_file.h
  60. cache-utils.c
  61. cache-utils.h
  62. Changelog
  63. check-qdict.c
  64. check-qfloat.c
  65. check-qint.c
  66. check-qjson.c
  67. check-qlist.c
  68. check-qstring.c
  69. cmd.c
  70. cmd.h
  71. cocoa.m
  72. CODING_STYLE
  73. config.h
  74. configure
  75. console.c
  76. console.h
  77. COPYING
  78. COPYING.LIB
  79. cpu-all.h
  80. cpu-common.h
  81. cpu-defs.h
  82. cpu-exec.c
  83. cpus.c
  84. cpus.h
  85. create_config
  86. cris-dis.c
  87. curses.c
  88. curses_keys.h
  89. cutils.c
  90. d3des.c
  91. d3des.h
  92. def-helper.h
  93. device_tree.c
  94. device_tree.h
  95. dis-asm.h
  96. disas.c
  97. disas.h
  98. dma-helpers.c
  99. dma.h
  100. dyngen-exec.h
  101. elf.h
  102. envlist.c
  103. envlist.h
  104. exec-all.h
  105. exec.c
  106. feature_to_c.sh
  107. gdbstub.c
  108. gdbstub.h
  109. gen-icount.h
  110. host-utils.c
  111. host-utils.h
  112. hpet.h
  113. hppa-dis.c
  114. hppa.ld
  115. hxtool
  116. i386-dis.c
  117. i386.ld
  118. ia64-dis.c
  119. ia64.ld
  120. input.c
  121. ioport-user.c
  122. ioport.c
  123. ioport.h
  124. iov.c
  125. iov.h
  126. json-lexer.c
  127. json-lexer.h
  128. json-parser.c
  129. json-parser.h
  130. json-streamer.c
  131. json-streamer.h
  132. keymaps.c
  133. keymaps.h
  134. kvm-all.c
  135. kvm-stub.c
  136. kvm.h
  137. libfdt_env.h
  138. LICENSE
  139. linux-aio.c
  140. m68k-dis.c
  141. m68k-semi.c
  142. m68k.ld
  143. MAINTAINERS
  144. Makefile
  145. Makefile.dis
  146. Makefile.hw
  147. Makefile.objs
  148. Makefile.target
  149. Makefile.user
  150. microblaze-dis.c
  151. migration-exec.c
  152. migration-fd.c
  153. migration-tcp.c
  154. migration-unix.c
  155. migration.c
  156. migration.h
  157. mips-dis.c
  158. mips.ld
  159. module.c
  160. module.h
  161. monitor.c
  162. monitor.h
  163. nbd.c
  164. nbd.h
  165. net-checksum.c
  166. net.c
  167. net.h
  168. notify.c
  169. notify.h
  170. osdep.c
  171. osdep.h
  172. path.c
  173. pci-ids.txt
  174. poison.h
  175. posix-aio-compat.c
  176. ppc-dis.c
  177. ppc.ld
  178. ppc64.ld
  179. qbool.c
  180. qbool.h
  181. qdict-test-data.txt
  182. qdict.c
  183. qdict.h
  184. qemu-aio.h
  185. qemu-barrier.h
  186. qemu-binfmt-conf.sh
  187. qemu-char.c
  188. qemu-char.h
  189. qemu-common.h
  190. qemu-config.c
  191. qemu-config.h
  192. qemu-doc.texi
  193. qemu-error.c
  194. qemu-error.h
  195. qemu-img-cmds.hx
  196. qemu-img.c
  197. qemu-img.texi
  198. qemu-io.c
  199. qemu-lock.h
  200. qemu-log.h
  201. qemu-malloc.c
  202. qemu-monitor.hx
  203. qemu-nbd.c
  204. qemu-nbd.texi
  205. qemu-objects.h
  206. qemu-option.c
  207. qemu-option.h
  208. qemu-options.hx
  209. qemu-queue.h
  210. qemu-sockets.c
  211. qemu-tech.texi
  212. qemu-thread.c
  213. qemu-thread.h
  214. qemu-timer.c
  215. qemu-timer.h
  216. qemu-tool.c
  217. qemu-x509.h
  218. qemu.sasl
  219. qemu_socket.h
  220. qerror.c
  221. qerror.h
  222. qfloat.c
  223. qfloat.h
  224. qint.c
  225. qint.h
  226. qjson.c
  227. qjson.h
  228. qlist.c
  229. qlist.h
  230. qobject.h
  231. qstring.c
  232. qstring.h
  233. readline.c
  234. readline.h
  235. README
  236. rules.mak
  237. rwhandler.c
  238. rwhandler.h
  239. s390-dis.c
  240. s390.ld
  241. savevm.c
  242. sdl.c
  243. sdl_keysym.h
  244. sdl_zoom.c
  245. sdl_zoom.h
  246. sdl_zoom_template.h
  247. sh4-dis.c
  248. softmmu-semi.h
  249. softmmu_defs.h
  250. softmmu_exec.h
  251. softmmu_header.h
  252. softmmu_template.h
  253. sparc-dis.c
  254. sparc.ld
  255. sparc64.ld
  256. sysemu.h
  257. targphys.h
  258. tcg-runtime.c
  259. texi2pod.pl
  260. thunk.c
  261. thunk.h
  262. TODO
  263. translate-all.c
  264. uboot_image.h
  265. usb-bsd.c
  266. usb-linux.c
  267. usb-stub.c
  268. VERSION
  269. vgafont.h
  270. vl.c
  271. vnc-auth-sasl.c
  272. vnc-auth-sasl.h
  273. vnc-auth-vencrypt.c
  274. vnc-auth-vencrypt.h
  275. vnc-encoding-hextile.c
  276. vnc-encoding-zlib.c
  277. vnc-tls.c
  278. vnc-tls.h
  279. vnc.c
  280. vnc.h
  281. vnc_keysym.h
  282. vnchextile.h
  283. x86_64.ld
  284. x_keymap.c
  285. x_keymap.h