Re: [PATCH RFC] mm: Implement balance_dirty_pages() through waiting for flusher thread

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, 2010-06-21 at 23:14 -0700, Andrew Morton wrote:
> +/*
> + * Compare counter against given value.
> + * Return 1 if greater, 0 if equal and -1 if less
> + */
> +int percpu_counter_compare(struct percpu_counter *fbc, s64 rhs)
> +{
> +       s64     count;
> +
> +       count = percpu_counter_read(fbc);
> +       /* Check to see if rough count will be sufficient for comparison */
> +       if (abs(count - rhs) > (percpu_counter_batch*num_online_cpus())) {
> +               if (count > rhs)
> +                       return 1;
> +               else
> +                       return -1;
> +       }
> +       /* Need to use precise count */
> +       count = percpu_counter_sum(fbc);
> +       if (count > rhs)
> +               return 1;
> +       else if (count < rhs)
> +               return -1;
> +       else
> +               return 0;
> +}
> +EXPORT_SYMBOL(percpu_counter_compare); 

That won't quite work as advertised for the bdi stuff since we use a
custom batch size.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxxx  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]