CHROMIUM: mm: Fix calculation of dirtyable memory

The system uses global_dirtyable_memory() to calculate
number of dirtyable pages/pages that can be allocated
to the page cache.  A bug causes an underflow thus making
the page count look like a big unsigned number.  This in turn
confuses the dirty writeback throttling to aggressively write
back pages as they become dirty (usually 1 page at a time).

Fix is to ensure there is no underflow while doing the math.

Signed-off-by: Sonny Rao <sonnyrao@chromium.org>
Signed-off-by: Puneet Kumar <puneetster@chromium.org>

BUG=chrome-os-partner:16011
TEST=Manual; boot kernel, powerwash, login with testaccount and
make sure no jank occurs on sync of applications

Change-Id: I614e7c3156e014f0f28a4ef9bdd8cb8a2cd07b2a
Reviewed-on: https://gerrit.chromium.org/gerrit/37612
Reviewed-by: Kees Cook <keescook@chromium.org>
Reviewed-by: Olof Johansson <olofj@chromium.org>
Commit-Ready: Puneet Kumar <puneetster@chromium.org>
Reviewed-by: Puneet Kumar <puneetster@chromium.org>
Tested-by: Puneet Kumar <puneetster@chromium.org>

Conflicts:
	mm/page-writeback.c
Fix warning in arch/arm/kernel/smp.c
Fix warning in mm/page-writeback.c
tuna: Enable Cortex A9 optimizations

Enable Zero fills and tune speculative SCU line feeds for tuna board
Revert "f2fs: drop obsolete node page when it is truncated"

This reverts commit 734d403685a45588dd0657cf311bf0f3e79803b2.
Revert "f2fs: introduce NODE_MAPPING for code consistency"

This reverts commit 24dd73adf1e2ab5a4050d144a13a2a9a5fa2ba64.
Revert "f2fs: remove the orphan block page array"

This reverts commit 460ed3296e533cf8c29571b7c212faf9ce1f94d9.
Revert "f2fs: add help function META_MAPPING"

This reverts commit bc020a9dba11b4cbbd41caad5060a104dfe9a357.
Revert "f2fs: move a branch for code redability"

This reverts commit df991c6f681330af6981563eb8c7e97406200b05.
Revert "f2fs: call mark_inode_dirty to flush dirty pages"

This reverts commit 7f860fc5205a8520a49fcd3cad6ce0e6ad3c70a9.
Revert "f2fs: clean checkpatch warnings"

This reverts commit dde44e774ff8c1df3450545d5f53debc73840255.
Revert "f2fs: missing REQ_META and REQ_PRIO when sync_meta_pages(META_FLUSH)"

This reverts commit 1fa4532ecae96305318a5e3321407a556ad1035f.
Revert "f2fs: avoid f2fs_balance_fs call during pageout"

This reverts commit 37b59438b0ce40932edee80d9a69801f81c40b71.
Revert "f2fs: add delimiter to seperate name and value in debug phrase"

This reverts commit bb78d753be162ee368aafd6ee681aa223d5ae63f.
Revert "f2fs: use spinlock rather than mutex for better speed"

This reverts commit bcc8baed48b6a47a679929aca8487dcf25a03601.
Revert "f2fs: move alloc new orphan node out of lock protection region"

This reverts commit 67d2013b4a4e760a0e7ca081900accb4bc7df69c.
Revert "f2fs: move grabing orphan pages out of protection region"

This reverts commit 4ac4b4228ccf805f26cb4ef608d0d20558ea136b.
Revert "f2fs: remove the needless parameter of f2fs_wait_on_page_writeback"

This reverts commit 82bf2ce88fdc3441aa874beac5f1358b50602038.
Revert "f2fs: add a sysfs entry to control max_victim_search"

This reverts commit 3367e7a535948327437674d69bb1c3098d320864.
Revert "f2fs: improve write performance under frequent fsync calls"

This reverts commit df4001abd37f29c67659c9bf7664614a0a7904e3.