Re: [PATCH -mm] mm: fine-grained dirty_ratio_pcm and dirty_background_ratio_pcm(v2)

From: David Rientjes
Date: Mon Nov 10 2008 - 17:17:00 EST


On Mon, 10 Nov 2008, Andrea Righi wrote:

> The KB limit is a static value, the other depends on the dirtyable
> memory. If we want to preserve the same behaviour we should do the
> following:
>
> - when dirty_ratio changes to x:
> dirty_amount_in_bytes = x * dirtyable_memory / 100.
>
> - when dirty_amount_in_bytes changes to x:
> dirty_ratio = x / dirtyable_memory * 100
>

I think the idea is for a dynamic dirty_ratio based on a static value
dirty_amount_in_bytes:

dirtyable_memory = determine_dirtyable_memory() * PAGE_SIZE;
dirty_ratio = dirty_amount_in_bytes / dirtyable_memory;

> But anytime the dirtyable memory changes (as well as the total memory in
> the system) we should update both values accordingly to preserve the
> coherency between them.
>

Only dirty_ratio is actually updated if dirty_amount_in_bytes is static.

This allows you to control how many pages are NR_FILE_DIRTY or
NR_UNSTABLE_NFS and gives you the granularity that you want with
dirty_ratio_pcm, but on a byte scale instead of percent.

It's also a clean interface:

echo 200M > /proc/sys/vm/dirty_ratio_bytes
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/