Whamcloud - gitweb
DDN-675 virtio: fix high-order kmalloc() failures
virtio_scsi needs high-order (64KB) allocations for large SCSI
requests in atomic context. The __GFP_HIGH mask is intended for
such uses and should not have been removed from the mask.
Add a memory pool for these allocations in case of failure under
fragmentation to allow the IO to complete. The default number
of items in the mempool is 16, but it can be tuned at module load
time via a parameter in /etc/modprobe.d/lustre.conf:
options virtio_ring vring_desc_pool_sz=N
This avoids the need for excessive memory reservation that was
previously set with "vm.min_free_kbytes=1048576" and similar.
The __GFP_NOWARN flag is added to avoid scary stack dumps, and
instead a brief error message is printed periodically so that
it is possible to track whether there are still allocation
issues, but not so verbose as to cause undue alarm.
ll_ost_io01_053: page allocation failure: order:4, mode:0x104000
CPU: 5 PID: 946 Comm: ll_ost_io01_053 3.10.0-862.9.1.el7_lustre.ddn1
Call Trace:
__alloc_pages_nodemask+0x9b4/0xbb0
alloc_pages_current+0x98/0x110
__get_free_pages+0xe/0x40
kmalloc_order_trace+0x2e/0xa0
__kmalloc+0x211/0x230
virtqueue_add+0x1c4/0x4d0 [virtio_ring]
virtqueue_add_sgs+0x87/0xa0 [virtio_ring]
virtscsi_add_cmd+0x17a/0x270 [virtio_scsi]
virtscsi_kick_cmd+0x38/0xa0 [virtio_scsi]
virtscsi_queuecommand+0x15d/0x340 [virtio_scsi]
virtscsi_queuecommand_multi+0x6e/0xe0 [virtio_scsi]
scsi_dispatch_cmd+0xb0/0x240
scsi_queue_rq+0x5a5/0x6f0
blk_mq_dispatch_rq_list+0x96/0x640
blk_mq_do_dispatch_ctx+0xe0/0x160
blk_mq_sched_dispatch_requests+0x138/0x1c0
__blk_mq_run_hw_queue+0xa2/0xb0
__blk_mq_delay_run_hw_queue+0x9d/0xb0
blk_mq_run_hw_queue+0x14/0x20
blk_mq_sched_insert_requests+0x64/0x80
blk_mq_flush_plug_list+0x19c/0x200
blk_flush_plug_list+0xce/0x230
blk_finish_plug+0x14/0x40
osd_do_bio.isra.25+0x651/0x8d0 [osd_ldiskfs]
osd_write_commit+0x3fc/0x8d0 [osd_ldiskfs]
ofd_commitrw_write+0xffe/0x1c90 [ofd]
ofd_commitrw+0x4c9/0xae0 [ofd]
obd_commitrw+0x2f3/0x336 [ptlrpc]
tgt_brw_write+0xffd/0x17d0 [ptlrpc]
tgt_request_handle+0x92a/0x1370 [ptlrpc]
ptlrpc_server_handle_request+0x23b/0xaa0 [ptlrpc]
ptlrpc_main+0xa92/0x1e40 [ptlrpc]
Signed-off-by: Andreas Dilger <adilger@whamcloud.com>
Change-Id: I35d5ed6d0d83648e1b7f625a4f3c4c8a333ebbe5
Reviewed-by: Wang Shilong <wshilong@whamcloud.com>
Reviewed-by: Li Xi <lixi@ddn.com>
Reviewed-on: https://review.whamcloud.com/41845
Tested-by: jenkins <devops@whamcloud.com>