linux/drivers/media
Mauro Carvalho Chehab 57208e5e25 [media] media: convert links from array to list
The entire logic that represent graph links were developed on a
time where there were no needs to dynamic remove links. So,
although links are created/removed one by one via some
functions, they're stored as an array inside the entity struct.

As the array may grow, there's a logic inside the code that
checks if the amount of space is not enough to store
the needed links. If it isn't the core uses krealloc()
to change the size of the link, with is bad, as it
leaves the memory fragmented.

So, convert links into a list.

Also, currently,  both source and sink entities need the link
at the graph traversal logic inside media_entity. So there's
a logic duplicating all links. That makes it to spend
twice the memory needed. This is not a big deal for today's
usage, where the number of links are not big.

Yet, if during the MC workshop discussions, it was said that
IIO graphs could have up to 4,000 entities. So, we may
want to remove the duplication on some future. The problem
is that it would require a separate linked list to store
the backlinks inside the entity, or to use a more complex
algorithm to do graph backlink traversal, with is something
that the current graph traversal inside the core can't cope
with. So, let's postpone a such change if/when it is actually
needed.

It should also be noticed that the media_link structure uses
44 bytes on 32-bit architectures and 84 bytes on 64-bit
architecture. It will thus be allocated out of the 64-bytes and
96-bytes pools respectively. That's a 12.5% memory waste on
64-bit architectures and 31.25% on 32-bit architecture.
A linked list is less efficient than an array in this case, but
this could later be optimized if we can get rid of the reverse
links (with would reduce memory allocation by 50%).

Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
2016-01-11 12:18:46 -02:00
..
common smsir.h: remove a now duplicated definition (IR_DEFAULT_TIMEOUT) 2015-11-19 11:41:36 -02:00
dvb-core [media] media: convert links from array to list 2016-01-11 12:18:46 -02:00
dvb-frontends [media] media: get rid of unused "extra_links" param on media_entity_init() 2016-01-11 12:18:39 -02:00
firewire [media] dvb: Get rid of typedev usage for enums 2015-06-09 17:47:35 -03:00
i2c [media] smiapp: create pad links after subdev registration 2016-01-11 12:18:46 -02:00
mmc [media] siano: register media controller earlier 2015-02-26 09:10:39 -03:00
pci [media] cx23885-dvb: move initialization of a8293_pdata 2015-12-18 15:20:44 -02:00
platform [media] v4l: vsp1: separate links creation from entities init 2016-01-11 12:18:45 -02:00
radio [media] media, sound: tea575x: constify snd_tea575x_ops structures 2015-12-03 11:26:45 -02:00
rc [media] rc: sunxi-cir: Initialize the spinlock properly 2015-12-23 15:51:40 -02:00
tuners [media] tv tuner max2165 driver: extend frequency range 2015-11-19 11:19:42 -02:00
usb [media] media: convert links from array to list 2016-01-11 12:18:46 -02:00
v4l2-core [media] media: get rid of unused "extra_links" param on media_entity_init() 2016-01-11 12:18:39 -02:00
Kconfig [media] Kconfig: Re-enable Media controller support for DVB 2016-01-11 12:18:40 -02:00
Makefile
media-device.c [media] media: convert links from array to list 2016-01-11 12:18:46 -02:00
media-devnode.c
media-entity.c [media] media: convert links from array to list 2016-01-11 12:18:46 -02:00