示例#1
0
static unsigned long highmem_dirtyable_memory(unsigned long total)
{
#ifdef CONFIG_HIGHMEM
	int node;
	unsigned long x = 0;

	for_each_node_state(node, N_HIGH_MEMORY) {
		unsigned long nr_pages;
		struct zone *z =
			&NODE_DATA(node)->node_zones[ZONE_HIGHMEM];

		nr_pages = zone_page_state(z, NR_FREE_PAGES) +
		  zone_reclaimable_pages(z);
		/*
		 * make sure that the number of pages for this node
		 * is never "negative".
		 */
		nr_pages -= min(nr_pages, z->dirty_balance_reserve);
		x += nr_pages;
	}
static unsigned long highmem_dirtyable_memory(unsigned long total)
{
#ifdef CONFIG_HIGHMEM
	int node;
	unsigned long x = 0;

	for_each_node_state(node, N_HIGH_MEMORY) {
		struct zone *z =
			&NODE_DATA(node)->node_zones[ZONE_HIGHMEM];

		x += zone_page_state(z, NR_FREE_PAGES) +
		     zone_reclaimable_pages(z);
	}
	/*
	 * Make sure that the number of highmem pages is never larger
	 * than the number of the total dirtyable memory. This can only
	 * occur in very strange VM situations but we want to make sure
	 * that this does not occur.
	 */
	return min(x, total);
#else
	return 0;
#endif
}