Re: make swappiness safer to use

Fengguang Wu
2007-08-01T01:22:22Z

On Wed, Aug 01, 2007 at 09:19:25AM +0800, Fengguang Wu wrote:
> > + imbalance *= (vm_swappiness + 1) / 100;
> ~~~~~~~~~~~~~~~~~~~~~~~~~ It will be zero!
>
> Better to scale it up before the division:
> imbalance *= (vm_swappiness + 1) * 1024 / 100;
>
> > +
> > + /*
> > + * If not much of the ram is mapped, makes the imbalance
> > + * less relevant, it's high priority we refill the inactive
> > + * list with mapped pages only in presence of high ratio of
> > + * mapped pages.
> > + *
> > + * Max temporary value is vm_total_pages*100.
> > + */
> > + imbalance *= mapped_ratio / 100;
>
> imbalance *= mapped_ratio * 1024 / 100;
>
> > + /* apply imbalance feedback to swap_tendency */
> > + swap_tendency += imbalance;
>
> swap_tendency += imbalance / 1024 / 1024;

Or simply move the two ' / 100' to this last line?