shmem: cleanup shmem_add_to_page_cache
authorHugh Dickins <hughd@google.com>
Wed, 11 Jul 2012 21:02:48 +0000 (14:02 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Jul 2012 23:04:48 +0000 (16:04 -0700)
commitb065b4321fa78e83bf8f5b0d79d0b5424b57998b
tree353111b96469e4499faf8513c039ac9043236443
parentd189922862e03ce6c7adc1e99d3b94e632dc8e89
shmem: cleanup shmem_add_to_page_cache

shmem_add_to_page_cache() has three callsites, but only one of them wants
the radix_tree_preload() (an exceptional entry guarantees that the radix
tree node is present in the other cases), and only that site can achieve
mem_cgroup_uncharge_cache_page() (PageSwapCache makes it a no-op in the
other cases).  We did it this way originally to reflect
add_to_page_cache_locked(); but it's confusing now, so move the radix_tree
preloading and mem_cgroup uncharging to that one caller.

Signed-off-by: Hugh Dickins <hughd@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
Cc: Michal Hocko <mhocko@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/shmem.c