linux/block/partitions
Ming Lei ac2e5327a5 block/partitions: optimize memory allocation in check_partition()
Currently, sizeof(struct parsed_partitions) may be 64KB in 32bit arch, so
it is easy to trigger page allocation failure by check_partition,
especially in hotplug block device situation(such as, USB mass storage,
MMC card, ...), and Felipe Balbi has observed the failure.

This patch does below optimizations on the allocation of struct
parsed_partitions to try to address the issue:

- make parsed_partitions.parts as pointer so that the pointed memory can
  fit in 32KB buffer, then approximate 32KB memory can be saved

- vmalloc the buffer pointed by parsed_partitions.parts because 32KB is
  still a bit big for kmalloc

- given that many devices have the partition count limit, so only
  allocate disk_max_parts() partitions instead of 256 partitions always

Signed-off-by: Ming Lei <ming.lei@canonical.com>
Reported-by: Felipe Balbi <balbi@ti.com>
Cc: Jens Axboe <axboe@kernel.dk>
Reviewed-by: Yasuaki Ishimatsu <isimatu.yasuaki@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2013-02-27 19:10:21 -08:00
..
Kconfig partitions: enable EFI/GPT support by default 2012-12-06 14:34:58 +01:00
Makefile move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
acorn.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
acorn.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
amiga.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
amiga.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
atari.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
atari.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
check.c block/partitions: optimize memory allocation in check_partition() 2013-02-27 19:10:21 -08:00
check.h block/partitions: optimize memory allocation in check_partition() 2013-02-27 19:10:21 -08:00
efi.c block/partitions/efi.c: ensure that the GPT header is at least the size of the structure. 2013-02-27 19:10:21 -08:00
efi.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ibm.c s390/partitions: make partition detection independent from DASD ioctls 2012-09-26 15:45:05 +02:00
ibm.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
karma.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
karma.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ldm.c LDM: Fix reassembly of extended VBLKs. 2012-02-24 09:37:42 +00:00
ldm.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
mac.c block/partitions/mac.c: obey the state->limit constraint 2013-02-27 19:10:21 -08:00
mac.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
msdos.c block/partition/msdos: detect AIX formatted disks even without 55aa 2013-02-27 19:10:21 -08:00
msdos.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
osf.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
osf.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sgi.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sgi.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sun.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sun.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sysv68.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
sysv68.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ultrix.c move fs/partitions to block/ 2012-01-03 22:54:06 -05:00
ultrix.h move fs/partitions to block/ 2012-01-03 22:54:06 -05:00