]> git.baikalelectronics.ru Git - kernel.git/commit
xen/blkfront: limit allocated memory size to actual use case
authorJuergen Gross <jgross@suse.com>
Fri, 17 Jan 2020 14:39:55 +0000 (15:39 +0100)
committerJens Axboe <axboe@kernel.dk>
Thu, 30 Jan 2020 04:13:18 +0000 (21:13 -0700)
commit5a830c2f354b18fa48a79abfb01381d589d5fed3
treea27d225fd5515133506325e6dd758ebce6ad07f8
parent7a31025ce40b0fcd93790d8c354361aee99bf31e
xen/blkfront: limit allocated memory size to actual use case

Today the Xen blkfront driver allocates memory for one struct
blkfront_ring_info for each communication ring. This structure is
statically sized for the maximum supported configuration resulting
in a size of more than 90 kB.

As the main size contributor is one array inside the struct, the
memory allocation can easily be limited by moving this array to be
the last structure element and to allocate only the memory for the
actually needed array size.

Acked-by: Roger Pau Monné <roger.pau@citrix.com>
Signed-off-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/block/xen-blkfront.c