/* Given a desired number of PAGE_CACHE_SIZE readahead pages, return a sensible upper limit.  */
unsigned long max_sane_readahead(unsigned long nr)
/* Given a desired number of PAGE_CACHE_SIZE readahead pages, return a sensible upper limit.  */
unsigned long max_sane_readahead(unsigned long nr)
{
	return min(nr, (node_page_state(numa_node_id(), NR_INACTIVE_FILE)
		+ node_page_state(numa_node_id(), NR_FREE_PAGES)) / 2);
}