Messages in this thread | | | Date | Fri, 10 Oct 2008 09:41:39 +0900 | From | KAMEZAWA Hiroyuki <> | Subject | Re: [PATCH -mm] page-writeback: fine-grained dirty_ratio and dirty_background_ratio |
| |
On Thu, 09 Oct 2008 17:29:46 +0200 Andrea Righi <righi.andrea@gmail.com> wrote:
> The current granularity of 5% of dirtyable memory for dirty pages writeback is > too coarse for large memory machines and this will get worse as > memory-size/disk-speed ratio continues to increase. > > These large writebacks can be unpleasant for desktop or latency-sensitive > environments, where the time to complete a writeback can be perceived as a > lack of responsiveness by the whole system. > > So, something to define fine grained settings is needed. > > Following there's a similar solution as discussed in [1], but I tried to > simplify the things a little bit, in order to provide the same functionality > (in particular try to avoid backward compatibility problems) and reduce the > amount of code needed to implement an in-kernel parser to handle percentages > with decimals digits. > > The kernel provides the following parameters: > - dirty_ratio, dirty_background_ratio in percentage > (1 ... 100) > - dirty_ratio_pcm, dirty_background_ratio_pcm in units of percent mille > (1 ... 100,000) > > Both dirty_ratio and dirty_ratio_pcm refer to the same vm_dirty_ratio variable, > only the interface to read/write this value is different. The same is valid for > dirty_background_ratio and dirty_background_ratio_pcm. > > In this way it's possible to provide a fine grained interface to configure the > writeback policy and at the same time preserve the compatibility with the old > coarse grained dirty_ratio / dirty_background_ratio users. > > Examples: > # echo 5 > /proc/sys/vm/dirty_ratio > # cat /proc/sys/vm/dirty_ratio > 5 > # cat /proc/sys/vm/dirty_ratio_pcm > 5000 > > # echo 500 > /proc/sys/vm/dirty_ratio_pcm > # cat /proc/sys/vm/dirty_ratio > 0 > # cat /proc/sys/vm/dirty_ratio_pcm > 500 > > # echo 5500 > /proc/sys/vm/dirty_ratio_pcm > # cat /proc/sys/vm/dirty_ratio > 5 > # cat /proc/sys/vm/dirty_ratio_pcm > 5500 > I like this. thanks.
<snip>
> -int dirty_background_ratio = 5; > +int dirty_background_ratio = 5 * PERCENT_PCM; > > /* > * free highmem will not be subtracted from the total free memory > @@ -77,7 +77,7 @@ int vm_highmem_is_dirtyable; > /* > * The generator of dirty data starts writeback at this percentage > */ > -int vm_dirty_ratio = 10; > +int vm_dirty_ratio = 10 * PERCENT_PCM; > > /* > * The interval between `kupdate'-style writebacks, in jiffies > @@ -135,7 +135,8 @@ static int calc_period_shift(void) > { > unsigned long dirty_total; > > - dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) / 100; > + dirty_total = (vm_dirty_ratio * determine_dirtyable_memory()) > + / ONE_HUNDRED_PCM; > return 2 + ilog2(dirty_total - 1); > } > I wonder...isn't this overflow in 32bit system ?
Thanks, -Kame
| |