Sorry forgot the 2 gnuplot figures, attached now. > > 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 > > with limit=thresh+thresh/DIRTY_SCOPE > > gnuplot> set xrange [60000:90000] > gnuplot> plot 1 + (70000.0 - x)**3/(90000-70000.0)**3 > > Figures attached. The latter produces reasonably flat slope and I'll > give it a spin in the dd tests :) > > > You can clamp it at [0,2] or so. > > Looking at the figures, we may even do without the clamp because it's > already inside the range [0, 2]. > > > The implementation wouldn't be too horrid either, something like: > > > > unsigned long bdi_pos_ratio(..) > > { > > if (dirty > limit) > > return 0; > > > > if (dirty < 2*setpoint - limit) > > return 2 * SCALE; > > > > x = SCALE * (setpoint - dirty) / (limit - setpoint); > > xx = (x * x) / SCALE; > > xxx = (xx * x) / SCALE; > > > > return xxx; > > } > > Looks very neat, much simpler than the three curves solution! > > Thanks, > Fengguang
Attachment:
3rd-order-limit=thresh+halfscope.png
Description: PNG image
Attachment:
3rd-order-limit=thresh.png
Description: PNG image