From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965726AbcBDNMG (ORCPT ); Thu, 4 Feb 2016 08:12:06 -0500 Received: from mail-wm0-f65.google.com ([74.125.82.65]:36253 "EHLO mail-wm0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964999AbcBDNMD (ORCPT ); Thu, 4 Feb 2016 08:12:03 -0500 Date: Thu, 4 Feb 2016 15:11:59 +0200 From: "Kirill A. Shutemov" To: Andrew Morton , Andrea Arcangeli Cc: "Kirill A. Shutemov" , Hugh Dickins , Dave Hansen , Mel Gorman , Rik van Riel , Vlastimil Babka , Christoph Lameter , Naoya Horiguchi , Steve Capper , "Aneesh Kumar K.V" , Johannes Weiner , Michal Hocko , Jerome Marchand , Sasha Levin , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH 3/3] thp: limit number of object to scan on deferred_split_scan() Message-ID: <20160204131159.GA20399@node.shutemov.name> References: <20160121012237.GE7119@redhat.com> <1453378163-133609-1-git-send-email-kirill.shutemov@linux.intel.com> <1453378163-133609-4-git-send-email-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1453378163-133609-4-git-send-email-kirill.shutemov@linux.intel.com> User-Agent: Mutt/1.5.23.1 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 > Reported-by: Andrea Arcangeli > --- > 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. >>From 5b27991afe0e4018f2503593ade85d35ce045fbc Mon Sep 17 00:00:00 2001 From: "Kirill A. Shutemov" Date: Thu, 4 Feb 2016 15:40:03 +0300 Subject: [PATCH] thp: get deferred_split_scan() work again We really need to iterate over split_queue, not local empty list to get anything split from the shrinker. Signed-off-by: Kirill A. Shutemov Fixes: e3ae19535c66 ("thp: limit number of object to scan on deferred_split_scan()") --- mm/huge_memory.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/huge_memory.c b/mm/huge_memory.c index 36c070167b71..08fc0ba2207e 100644 --- a/mm/huge_memory.c +++ b/mm/huge_memory.c @@ -3482,7 +3482,7 @@ static unsigned long deferred_split_scan(struct shrinker *shrink, spin_lock_irqsave(&pgdata->split_queue_lock, flags); /* Take pin on all head pages to avoid freeing them under us */ - list_for_each_safe(pos, next, &list) { + list_for_each_safe(pos, next, &pgdata->split_queue) { page = list_entry((void *)pos, struct page, mapping); page = compound_head(page); if (get_page_unless_zero(page)) { -- Kirill A. Shutemov