[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20110727125947.GE4024@tiehlicka.suse.cz>
Date: Wed, 27 Jul 2011 14:59:47 +0200
From: Michal Hocko <mhocko@...e.cz>
To: Johannes Weiner <jweiner@...hat.com>
Cc: linux-mm@...ck.org, Dave Chinner <david@...morbit.com>,
Christoph Hellwig <hch@...radead.org>,
Mel Gorman <mgorman@...e.de>,
Andrew Morton <akpm@...ux-foundation.org>,
Wu Fengguang <fengguang.wu@...el.com>,
Rik van Riel <riel@...hat.com>,
Minchan Kim <minchan.kim@...il.com>, Jan Kara <jack@...e.cz>,
Andi Kleen <ak@...ux.intel.com>, linux-kernel@...r.kernel.org
Subject: Re: [patch 2/5] mm: writeback: make determine_dirtyable_memory
static again
On Mon 25-07-11 22:19:16, Johannes Weiner wrote:
> From: Johannes Weiner <hannes@...xchg.org>
>
> The tracing ring-buffer used this function briefly, but not anymore.
> Make it local to the writeback code again.
>
> Also, move the function so that no forward declaration needs to be
> reintroduced.
git grep says that the only reference is from the page-writeback.c and
the symbol is not exported to modules so this looks correct.
Moving it up in the file certainly makes sense.
> Signed-off-by: Johannes Weiner <hannes@...xchg.org>
Reviewed-by: Michal Hocko <mhocko@...e.cz>
> ---
> include/linux/writeback.h | 2 -
> mm/page-writeback.c | 85 ++++++++++++++++++++++-----------------------
> 2 files changed, 42 insertions(+), 45 deletions(-)
>
> diff --git a/include/linux/writeback.h b/include/linux/writeback.h
> index 17e7ccc..8c63f3a 100644
> --- a/include/linux/writeback.h
> +++ b/include/linux/writeback.h
> @@ -105,8 +105,6 @@ extern int vm_highmem_is_dirtyable;
> extern int block_dump;
> extern int laptop_mode;
>
> -extern unsigned long determine_dirtyable_memory(void);
> -
> extern int dirty_background_ratio_handler(struct ctl_table *table, int write,
> void __user *buffer, size_t *lenp,
> loff_t *ppos);
> diff --git a/mm/page-writeback.c b/mm/page-writeback.c
> index 31f6988..a4de005 100644
> --- a/mm/page-writeback.c
> +++ b/mm/page-writeback.c
> @@ -111,6 +111,48 @@ EXPORT_SYMBOL(laptop_mode);
>
> /* End of sysctl-exported parameters */
>
> +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
> +}
> +
> +/**
> + * determine_dirtyable_memory - amount of memory that may be used
> + *
> + * Returns the numebr of pages that can currently be freed and used
> + * by the kernel for direct mappings.
> + */
> +static unsigned long determine_dirtyable_memory(void)
> +{
> + unsigned long x;
> +
> + x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages();
> +
> + if (!vm_highmem_is_dirtyable)
> + x -= highmem_dirtyable_memory(x);
> +
> + return x + 1; /* Ensure that we never return 0 */
> +}
>
> /*
> * Scale the writeback cache size proportional to the relative writeout speeds.
> @@ -354,49 +396,6 @@ EXPORT_SYMBOL(bdi_set_max_ratio);
> * clamping level.
> */
>
> -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
> -}
> -
> -/**
> - * determine_dirtyable_memory - amount of memory that may be used
> - *
> - * Returns the numebr of pages that can currently be freed and used
> - * by the kernel for direct mappings.
> - */
> -unsigned long determine_dirtyable_memory(void)
> -{
> - unsigned long x;
> -
> - x = global_page_state(NR_FREE_PAGES) + global_reclaimable_pages();
> -
> - if (!vm_highmem_is_dirtyable)
> - x -= highmem_dirtyable_memory(x);
> -
> - return x + 1; /* Ensure that we never return 0 */
> -}
> -
> /*
> * global_dirty_limits - background-writeback and dirty-throttling thresholds
> *
> --
> 1.7.6
>
> --
> To unsubscribe, send a message with 'unsubscribe linux-mm' in
> the body to majordomo@...ck.org. For more info on Linux MM,
> see: http://www.linux-mm.org/ .
> Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
> Don't email: <a href=mailto:"dont@...ck.org"> email@...ck.org </a>
--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists