linux-hardened/include/linux/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
..
bbm.h mtd: nand: introduce NAND_CREATE_EMPTY_BBT 2010-10-25 00:54:37 +01:00
blktrans.h Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6 into for-linus-1 2011-03-25 17:41:20 +02:00
cfi.h Fix common misspellings 2011-03-31 11:26:23 -03:00
cfi_endian.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
concat.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
doc2000.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
flashchip.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
fsmc.h mtd: FSMC NAND fix obvious speling errors 2010-12-03 16:35:40 +00:00
ftl.h
gen_probe.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
inftl.h mtd: inftl.h: fix spacing errors 2010-10-24 23:27:24 +01:00
latch-addr-flash.h mtd: NOR flash driver for OMAP-L137/AM17x 2011-03-11 14:22:47 +00:00
map.h mtd: Remove obsolete <mtd/compatmac.h> include 2010-08-08 21:19:42 +01:00
mtd.h mtd: create function to perform large allocations 2011-05-25 01:59:43 +01:00
mtdram.h mtd: mtdram.h: checkpatch cleanup 2010-05-10 14:11:30 +01:00
nand-gpio.h
nand.h mtd: nand: renumber conflicting BBT flags 2011-05-25 01:49:43 +01:00
nand_bch.h mtd: nand: add software BCH ECC support 2011-03-11 17:49:08 +00:00
nand_ecc.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
ndfc.h
nftl.h mtd: Update copyright notices 2010-08-08 20:58:20 +01:00
onenand.h mtd: onenand: add new option to control initial onenand unlocking 2011-03-11 14:22:47 +00:00
onenand_regs.h OMAP: OneNAND: fix 104MHz support 2011-02-17 15:44:45 -08:00
partitions.h mtd: fix master device identification for mtd repartition 2010-12-03 16:32:35 +00:00
pfow.h
physmap.h mtd-physmap: add support users can assign the probe type in board files 2010-08-08 12:28:15 +01:00
pismo.h mtd: Really add ARM pismo support 2010-01-13 09:04:53 +00:00
plat-ram.h
pmc551.h
qinfo.h
sh_flctl.h mtd/nand/sh_flctl: Move function mtd_to_flctl to fix build failure 2010-05-12 23:24:23 +01:00
sharpsl.h
super.h convert get_sb_mtd() users to ->mount() 2010-10-29 04:16:26 -04:00
ubi.h UBI: provide LEB offset information 2011-03-08 10:12:48 +02:00
xip.h Fix common misspellings 2011-03-31 11:26:23 -03:00