Re: [PATCH v5 2/2] mm, thp: avoid unnecessary swapin in khugepaged

From: Rik van Riel
Date: Thu Apr 07 2016 - 13:34:56 EST


On Thu, 2016-04-07 at 20:28 +0300, Ebru Akagunduz wrote:
> Currently khugepaged makes swapin readahead to improve
> THP collapse rate. This patch checks vm statistics
> to avoid workload of swapin, if unnecessary. So that
> when system under pressure, khugepaged won't consume
> resources to swapin and won't trigger direct reclaim
> when swapin readahead.
>
> The patch was tested with a test program that allocates
> 800MB of memory, writes to it, and then sleeps. The system
> was forced to swap out all. Afterwards, the test program
> touches the area by writing, it skips a page in each
> 20 pages of the area. When waiting to swapin readahead
> left part of the test, the memory forced to be busy
> doing page reclaim. There was enough free memory during
> test, khugepaged did not swapin readahead due to business.
>
> Test results:
>
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂAfter swapped out
> -------------------------------------------------------------------
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| Anonymous | AnonHugePages | SwapÂÂÂÂÂÂ| FractionÂÂ|
> -------------------------------------------------------------------
> With patchÂÂÂÂ| 0 kBÂÂÂÂÂÂ|ÂÂ0 kBÂÂÂÂÂÂÂÂÂ| 800000 kB |ÂÂÂÂ%100ÂÂÂ|
> -------------------------------------------------------------------
> Without patch | 0 kBÂÂÂÂÂÂ|ÂÂ0 kBÂÂÂÂÂÂÂÂÂ| 800000 kB |ÂÂÂÂ%100ÂÂÂ|
> -------------------------------------------------------------------
>
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂAfter swapped in
> -------------------------------------------------------------------
> ÂÂÂÂÂÂÂÂÂÂÂÂÂÂ| Anonymous | AnonHugePages | SwapÂÂÂÂÂÂ| FractionÂÂ|
> -------------------------------------------------------------------
> With patchÂÂÂÂ| 384812 kB | 96256 kBÂÂÂÂÂÂ| 415188 kB |ÂÂÂÂ%25ÂÂÂÂ|
> -------------------------------------------------------------------
> Without patch | 389728 kB | 194560 kBÂÂÂÂÂ| 410272 kB |ÂÂÂÂ%49ÂÂÂÂ|
> -------------------------------------------------------------------
>
> Signed-off-by: Ebru Akagunduz <ebru.akagunduz@xxxxxxxxx>

Acked-by: Rik van Riel <riel@xxxxxxxxxx>

--
All Rights Reversed.

Attachment: signature.asc
Description: This is a digitally signed message part