lkml.org 
[lkml]   [2011]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 2/5] writeback: dirty position control
> > Making our final function look like:
> >
> > s - x 3
> > f(x) := 1 + (-----)
> > l - s
>
> Very intuitive reasoning, thanks!
>
> I substituted real numbers to the function assuming a mem=2GB system.
>
> with limit=thresh:
>
> gnuplot> set xrange [60000:80000]
> gnuplot> plot 1 + (70000.0 - x)**3/(80000-70000.0)**3

I'll use the above one, which is more simple and elegant:

f(freerun) = 2.0
f(setpoint) = 1.0
f(limit) = 0

Code is

unsigned long freerun = (thresh + bg_thresh) / 2;

setpoint = (limit + freerun) / 2;
pos_ratio = abs(dirty - setpoint);
pos_ratio <<= BANDWIDTH_CALC_SHIFT;
do_div(pos_ratio, limit - setpoint + 1);
x = pos_ratio;
pos_ratio = pos_ratio * x >> BANDWIDTH_CALC_SHIFT;
pos_ratio = pos_ratio * x >> BANDWIDTH_CALC_SHIFT;
if (dirty > setpoint)
pos_ratio = -pos_ratio;
pos_ratio += 1 << BANDWIDTH_CALC_SHIFT;

Thanks,
Fengguang


\
 
 \ /
  Last update: 2011-08-12 07:47    [W:0.239 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site