[Devel] [PATCH rh7 2/2] mm/page-writeback: Introduce per-CT dirty memory limit.

Vladimir Davydov vdavydov at virtuozzo.com
Tue Jan 19 01:43:37 PST 2016


On Fri, Jan 15, 2016 at 06:17:25PM +0300, Andrey Ryabinin wrote:
> +void balance_dirty_pages_ratelimited_nr(struct address_space *mapping,
> +					unsigned long nr_pages_dirtied)
> +{
> +	unsigned long ratelimit;
> +	int *p;
> +
> +	ratelimit = ratelimit_pages;
> +	if (mapping->backing_dev_info->dirty_exceeded ||
> +	    test_bit(UB_DIRTY_EXCEEDED, &get_io_ub()->ub_flags))
> +		ratelimit = 8;
> +
> +	/*
> +	 * Check the rate limiting. Also, we do not want to throttle real-time
> +	 * tasks in balance_dirty_pages(). Period.
> +	 */
> +	preempt_disable();
> +	p =  &__get_cpu_var(bdp_ratelimits);
> +	*p += nr_pages_dirtied;
> +	if (unlikely(*p >= ratelimit)) {
> +		ratelimit = sync_writeback_pages(*p);
> +		*p = 0;
> +		preempt_enable();
> +		balance_dirty_pages_ub(mapping, ratelimit);
> +		return;
> +	}
> +	preempt_enable();
> +}

I don't think it makes sense copying ratelimiting code from RH6. I guess
it wouldn't hurt if we just called balance_dirty_pages_ub every time we
call global balance_dirty_pages.


More information about the Devel mailing list