linux/drivers/mtd
Grant Erickson 33b53716bc mtd: create function to perform large allocations
Introduce a common function to handle large, contiguous kmalloc buffer
allocations by exponentially backing off on the size of the requested
kernel transfer buffer until it succeeds or until the requested
transfer buffer size falls below the page size.

This helps ensure the operation can succeed under low-memory, highly-
fragmented situations albeit somewhat more slowly.

Artem: so this patch solves the problem that the kernel tries to kmalloc too
large buffers, which (a) may fail and does fail - people complain about this,
and (b) slows down the system in case of high memory fragmentation, because
the kernel starts dropping caches, writing back, swapping, etc. But we do not
really have to allocate a lot of memory to do the I/O, we may do this even with
as little as one min. I/O unit (NAND page) of RAM. So the idea of this patch is
that if the user asks to read or write a lot, we try to kmalloc a lot, with GFP
flags which make the kernel _not_ drop caches, etc. If we can allocate it - good,
if not - we try to allocate twice as less, and so on, until we reach the min.
I/O unit size, which is our last resort allocation and use the normal
GFP_KERNEL flag.

Artem: re-write the allocation function so that it makes sure the allocated
buffer is aligned to the min. I/O size of the flash.

Signed-off-by: Grant Erickson <marathon96@gmail.com>
Tested-by: Ben Gardiner <bengardiner@nanometrics.ca>
Tested-by: Stefano Babic <sbabic@denx.de>
Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@nokia.com>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
2011-05-25 01:59:43 +01:00
..
chips mtd: cmdset_0002: add CFI 1.5 support for S29GL-S 2011-05-25 01:51:35 +01:00
devices mtd: m25p80: add support for the MX25L1606E chip 2011-05-25 01:47:46 +01:00
lpddr Fix common misspellings 2011-03-31 11:26:23 -03:00
maps drivercore: revert addition of of_match to struct device 2011-05-18 12:32:23 -06:00
nand mtd: omap2: mtd split nand_scan in ident and tail 2011-05-25 01:54:39 +01:00
onenand mtd: onenand: add ecclayout and subpage_sft for non-flex 4KiB page onenand 2011-05-25 01:50:42 +01:00
tests mtd: speedtest: fix integer overflow 2011-03-11 14:22:49 +00:00
ubi Merge branch 'for-linus' of git://git.infradead.org/ubifs-2.6 2011-04-07 11:31:03 -07:00
Kconfig mtdswap: kill strict error handling option 2011-03-25 17:04:18 +02:00
Makefile mtd: Add mtdswap block driver 2011-03-11 14:22:46 +00:00
afs.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ar7part.c
cmdlinepart.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ftl.c Update broken web addresses in the kernel. 2010-10-18 11:03:14 +02:00
inftlcore.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
inftlmount.c mtd: Remove obsolete <mtd/compatmac.h> include 2010-08-08 21:19:42 +01:00
mtd_blkdevs.c mtd: mtd_blkdevs: fix error path in blktrans_open 2011-05-25 01:53:45 +01:00
mtdblock.c Fix common misspellings 2011-03-31 11:26:23 -03:00
mtdblock_ro.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
mtdchar.c Fix common misspellings 2011-03-31 11:26:23 -03:00
mtdconcat.c mtd: mtdconcat: fix NAND OOB write 2011-05-25 01:54:50 +01:00
mtdcore.c mtd: create function to perform large allocations 2011-05-25 01:59:43 +01:00
mtdcore.h mtd: Replace static array of devices with an idr structure 2010-02-25 11:55:14 +00:00
mtdoops.c Merge git://git.infradead.org/mtd-2.6 2011-01-17 11:15:30 -08:00
mtdpart.c mtd: mtdpart: disallow reading OOB past the end of the partition 2011-01-17 15:25:48 +00:00
mtdsuper.c convert get_sb_mtd() users to ->mount() 2010-10-29 04:16:26 -04:00
mtdswap.c mtd: mtdswap: fix printk format warning 2011-04-01 16:44:31 +03:00
nftlcore.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
nftlmount.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ofpart.c mtd: Fix endianness issues from device tree 2010-10-25 00:55:56 +01:00
redboot.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
rfd_ftl.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
sm_ftl.c Fix common misspellings 2011-03-31 11:26:23 -03:00
sm_ftl.h mtd: sm_ftl: cosmetic, use bool when possible 2010-10-25 01:33:08 +01:00
ssfdc.c mtd: Update copyright notices 2010-08-08 20:58:20 +01:00