lkml.org 
[lkml]   [2011]   [Jul]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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@cmpxchg.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@cmpxchg.org>

Reviewed-by: Michal Hocko <mhocko@suse.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@kvack.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@kvack.org"> email@kvack.org </a>

--
Michal Hocko
SUSE Labs
SUSE LINUX s.r.o.
Lihovarska 1060/12
190 00 Praha 9
Czech Republic


\
 
 \ /
  Last update: 2011-07-27 15:03    [W:0.191 / U:0.072 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site