RE: [RFC][PATCH] avoid swapping out with swappiness==0
From: Satoru Moriya
Date: Fri Mar 02 2012 - 18:43:25 EST
Hi Rik,
Thank you for reviewing.
On 03/02/2012 05:47 PM, Rik van Riel wrote:
> On 03/02/2012 12:36 PM, Satoru Moriya wrote:
>> @@ -1999,7 +1999,7 @@ out:
>> unsigned long scan;
>>
>> scan = zone_nr_lru_pages(mz, lru);
>> - if (priority || noswap) {
>> + if (priority || noswap || !vmscan_swappiness(mz, sc)) {
>> scan>>= priority;
>> if (!scan&& force_scan)
>> scan = SWAP_CLUSTER_MAX;
>
> However, I do not understand why we fail to scale the number of pages
> we want to scan with priority if "noswap".
>
> For that matter, surely if we do not want to swap out anonymous pages,
> we WANT to go into this if branch, in order to make sure we set "scan"
> to 0?
>
> scan = div64_u64(scan * fraction[file], denominator);
>
> With your patch and swappiness=0, or no swap space, it looks like we
> do not zero out "scan" and may end up scanning anonymous pages.
With my patch, if swappiness==0 or noswap==1, fraction[file] is
set to 0. As a result, scan will be set to 0, too.
> Am I overlooking something? Is this correct?
>
> I mean, it is Friday and my brain is very full...
Have a nice weekend ;)
Regards,
Satoru
èº{.nÇ+·®+%Ëlzwm
ébëæìr¸zX§»®w¥{ayºÊÚë,j¢f£¢·hàz¹®w¥¢¸¢·¦j:+v¨wèjØm¶ÿ¾«êçzZ+ùÝj"ú!¶iOæ¬z·vØ^¶m§ÿðÃnÆàþY&