Re: [PATCH 3/3] thp: limit number of object to scan on deferred_split_scan()

From: Kirill A. Shutemov
Date: Thu Feb 04 2016 - 08:12:10 EST


On Thu, Jan 21, 2016 at 03:09:23PM +0300, Kirill A. Shutemov wrote:
> If we have a lot of pages in queue to be split, deferred_split_scan()
> can spend unreasonable amount of time under spinlock with disabled
> interrupts.
>
> Let's cap number of pages to split on scan by sc->nr_to_scan.
>
> Signed-off-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>
> Reported-by: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> ---
> mm/huge_memory.c | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/mm/huge_memory.c b/mm/huge_memory.c
> index 36f98459f854..298dbc001b07 100644
> --- a/mm/huge_memory.c
> +++ b/mm/huge_memory.c
> @@ -3478,17 +3478,19 @@ static unsigned long deferred_split_scan(struct shrinker *shrink,
> int split = 0;
>
> spin_lock_irqsave(&pgdata->split_queue_lock, flags);
> - list_splice_init(&pgdata->split_queue, &list);
> -
> /* Take pin on all head pages to avoid freeing them under us */
> list_for_each_safe(pos, next, &list) {

Well, that's embarrassing... :-/

I forgot to commit one local change here. Sorry.