[LTP] [PATCH v2] swapping: replace mem_free by mem_available

Li Wang liwang@redhat.com
Mon Aug 1 12:37:21 CEST 2016


On Mon, Aug 01, 2016 at 06:04:50AM -0400, Jan Stancek wrote:
> 
> ----- Original Message -----
> > +
> > +	/* at least 10MB available physical memory needed */
> > +	if (mem_available_init < 10240)
> >  			tst_brkm(TCONF, cleanup,
> > -				 "Not enough free memory to test.");
> > -	}
> > -	if (swap_free_init < mem_over)
> > -		tst_brkm(TCONF, cleanup, "Not enough swap space to test.");
> > +				 "Not enough avalable memory to test.");
> > +
> > +	if (swap_total < mem_over_max)
> > +		tst_brkm(TCONF, cleanup, "swap size is not fit to test");
> 
> Shouldn't this be "swap_free_init > mem_over_max"? Some of the swap
> can be used at the start of test and condition below compares the
> difference from initial value.

sure, that would be more precise.

> > -		}
> > +	i = 0;
> > +	while (i < 10) {
> > +		swap_free_now = read_meminfo("SwapFree:");
> >  		sleep(1);
> > +		if (abs(swap_free_now - read_meminfo("SwapFree:")) < 512)
> > +			break;
> > +
> > +		i++;
> >  	}
> > +
> 
> I'd probably add here:
>   swap_free_now = read_meminfo("SwapFree:");
> again, since current value can be stale.

Ok, agree your point. Thanks for reviewing.

Regards,
Li Wang


More information about the ltp mailing list