linux-hardened/drivers/vhost
Michal Hocko 6c5ab6511f mm: support __GFP_REPEAT in kvmalloc_node for >32kB
vhost code uses __GFP_REPEAT when allocating vhost_virtqueue resp.
vhost_vsock because it would really like to prefer kmalloc to the
vmalloc fallback - see 23cc5a991c ("vhost-net: extend device
allocation to vmalloc") for more context.  Michael Tsirkin has also
noted:

 "__GFP_REPEAT overhead is during allocation time. Using vmalloc means
  all accesses are slowed down. Allocation is not on data path, accesses
  are."

The similar applies to other vhost_kvzalloc users.

Let's teach kvmalloc_node to handle __GFP_REPEAT properly.  There are
two things to be careful about.  First we should prevent from the OOM
killer and so have to involve __GFP_NORETRY by default and secondly
override __GFP_REPEAT for !costly order requests as the __GFP_REPEAT is
ignored for !costly orders.

Supporting __GFP_REPEAT like semantic for !costly request is possible it
would require changes in the page allocator.  This is out of scope of
this patch.

This patch shouldn't introduce any functional change.

Link: http://lkml.kernel.org/r/20170306103032.2540-3-mhocko@kernel.org
Signed-off-by: Michal Hocko <mhocko@suse.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Cc: David Miller <davem@davemloft.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2017-05-08 17:15:12 -07:00
..
Kconfig tap: tap as an independent module 2017-02-11 20:59:41 -05:00
Kconfig.vringh vhost: split out vringh Kconfig 2016-08-02 16:54:28 +03:00
Makefile VSOCK: Add Makefile and Kconfig 2016-08-02 02:57:30 +03:00
net.c mm: support __GFP_REPEAT in kvmalloc_node for >32kB 2017-05-08 17:15:12 -07:00
scsi.c vhost/scsi: silence uninitialized variable warning 2017-01-19 23:46:30 +02:00
test.c Merge 4.8-rc5 into char-misc-next 2016-09-05 08:04:07 +02:00
test.h vhost test module 2010-12-09 16:00:21 +02:00
vhost.c mm: support __GFP_REPEAT in kvmalloc_node for >32kB 2017-05-08 17:15:12 -07:00
vhost.h vhost: introduce O(1) vq metadata cache 2017-03-02 01:35:06 +02:00
vringh.c vringh: kill off ACCESS_ONCE() 2016-12-16 00:13:36 +02:00
vsock.c mm: support __GFP_REPEAT in kvmalloc_node for >32kB 2017-05-08 17:15:12 -07:00