OpenCloudOS-Kernel/drivers/media
Tomasz Figa 758d90e161 [media] v4l2-core: Use kvmalloc() for potentially big allocations
There are multiple places where arrays or otherwise variable sized
buffer are allocated through V4L2 core code, including things like
controls, memory pages, staging buffers for ioctls and so on. Such
allocations can potentially require an order > 0 allocation from the
page allocator, which is not guaranteed to be fulfilled and is likely to
fail on a system with severe memory fragmentation (e.g. a system with
very long uptime).

Since the memory being allocated is intended to be used by the CPU
exclusively, we can consider using vmalloc() as a fallback and this is
exactly what the recently merged kvmalloc() helpers do. A kmalloc() call
is still attempted, even for order > 0 allocations, but it is done
with __GFP_NORETRY and __GFP_NOWARN, with expectation of failing if
requested memory is not available instantly. Only then the vmalloc()
fallback is used. This should give us fast and more reliable allocations
even on systems with higher memory pressure and/or more fragmentation,
while still retaining the same performance level on systems not
suffering from such conditions.

While at it, replace explicit array size calculations on changed
allocations with kvmalloc_array().

Purposedly not touching videobuf1, as it is deprecated, has only few
users remaining and would rather be seen removed instead.

Signed-off-by: Tomasz Figa <tfiga@chromium.org>
Acked-by: Marek Szyprowski <m.szyprowski@samsung.com>
Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
2017-06-20 09:11:48 -03:00
..
cec Linux 4.12-rc6 2017-06-20 08:51:56 -03:00
common [media] b2c2: constify nxt200x_config structure 2017-04-17 12:18:18 -03:00
dvb-core [media] dvb_ca_en50221: Fix wrong EXPORT_SYMBOL order 2017-06-07 13:21:25 -03:00
dvb-frontends [media] au8522: Set the initial modulation 2017-06-06 07:51:33 -03:00
firewire [media] firewire: don't break long lines 2016-10-21 10:06:00 -02:00
i2c [media] i2c: tc358743: remove useless variable assignment in tc358743_isr 2017-06-20 09:06:44 -03:00
mmc
pci [media] cx18: Fix a sleep-in-atomic bug in snd_cx18_pcm_hw_free 2017-06-07 12:28:50 -03:00
platform [media] media: fdp1: Support ES2 platforms 2017-06-20 09:07:44 -03:00
radio [media] wl128x: use setup_timer 2017-04-10 14:56:37 -03:00
rc [media] rc-core: cleanup rc_register_device pt2 2017-06-13 13:55:01 -03:00
spi [media] gs1662: drop kfree for memory allocated with devm_kzalloc 2016-10-24 17:59:08 -02:00
tuners [media] xc5000: Don't spin waiting for analog lock 2017-06-06 07:51:05 -03:00
usb [media] stih-cec/vivid/pulse8/rainshadow: use cec_transmit_attempt_done 2017-06-20 06:53:20 -03:00
v4l2-core [media] v4l2-core: Use kvmalloc() for potentially big allocations 2017-06-20 09:11:48 -03:00
Kconfig [media] cec: rename MEDIA_CEC_NOTIFIER to CEC_NOTIFIER 2017-06-04 15:23:35 -03:00
Makefile [media] cec: select CEC_CORE instead of depend on it 2017-06-04 15:23:33 -03:00
media-device.c [media] media: Rename graph and pipeline structs and functions 2017-01-27 16:13:24 -02:00
media-devnode.c media: utilize new cdev_device_add helper function 2017-03-21 06:44:33 +01:00
media-entity.c [media] media: entity: Add media_entity_get_fwnode_pad() function 2017-06-20 09:09:37 -03:00