Received: by 2002:ac0:8c9a:0:0:0:0:0 with SMTP id r26csp536824ima; Fri, 1 Feb 2019 07:07:31 -0800 (PST) X-Google-Smtp-Source: ALg8bN78svczyF+SSWJr5jyf+3Bqkk4j4OGurLrz2XF31VBvKT2RPpZiwgmtivxYpJ+qxJnUyqKo X-Received: by 2002:a17:902:b118:: with SMTP id q24mr40452431plr.209.1549033651304; Fri, 01 Feb 2019 07:07:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549033651; cv=none; d=google.com; s=arc-20160816; b=gEhU4WKfPhwRK0ENGOldl1iB0/hE35zknlOFhN64Ov5l+TdVaXZFt/iIqhlBeuF4N5 /jyG8h3YADodeJY12zdjkv3gtRiwVh6EfZXeI5OSTYTo7Pr4WCHC2mtgbOUUG7FzUhRt T2ovMuBSS657MpqKP45n1BnDAiJSKH8xLFd5c2ozhPANbAu8ljfUkeL/u04m5sSF1c1l 4hl/A6MLb00ZXaHYDFkXT648T7Wcku+hvCNJeHIWxu9yC9ykP8zlwMwd85T7AKHumMVI G048t/9NAfB1m1BUYJ4y0S3x8drmdOJFuV218OhvXR9diwtLKDhWhmQOudKZyMIF8M82 X6Lg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=ejJEqGTeL0OHykvCEe/yGOAYrR6KxeUCTBncO9JamkI=; b=IcuSvBxvh5g217UTQ3UU8deN1nlYTgiiZzdENRd3wdcV4gLdbV6OwC5sMQXwSws9/U r7znr9C+mN/jry57f+iJqeOsblpPErm4oxh4lUDbzkmoF2YjLRM9UqW9e+LcHf2LBp3d PU9IzeZ2p/Bm3/fSUykEEw8M8w+MOTdbVMgirh/8SEiYygC6VV/sgHjPQcXjF2+RhznE kJz2VY2vqmL5sPymcRiVdRsVqjfUvU9KW5o67jL1XM+d8Zf36e8qBMXOM+KxdsvJC+bJ uPXGYqwQ28dT2u09VT9vmSJdwvENcLtSXu+N+RQKqSrYL9husX2jd/56QLPOsieViIBy Gmgg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d7si7631800pfo.108.2019.02.01.07.07.15; Fri, 01 Feb 2019 07:07:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730161AbfBAPGS (ORCPT + 99 others); Fri, 1 Feb 2019 10:06:18 -0500 Received: from outbound-smtp12.blacknight.com ([46.22.139.17]:46547 "EHLO outbound-smtp12.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729043AbfBAPGR (ORCPT ); Fri, 1 Feb 2019 10:06:17 -0500 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp12.blacknight.com (Postfix) with ESMTPS id A50501C2246 for ; Fri, 1 Feb 2019 15:06:15 +0000 (GMT) Received: (qmail 22173 invoked from network); 1 Feb 2019 15:06:15 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.225.79]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 1 Feb 2019 15:06:15 -0000 Date: Fri, 1 Feb 2019 15:06:14 +0000 From: Mel Gorman To: Vlastimil Babka Cc: Andrew Morton , David Rientjes , Andrea Arcangeli , Linux List Kernel Mailing , Linux-MM Subject: Re: [PATCH 09/22] mm, compaction: Use free lists to quickly locate a migration source Message-ID: <20190201150614.GJ9565@techsingularity.net> References: <20190118175136.31341-1-mgorman@techsingularity.net> <20190118175136.31341-10-mgorman@techsingularity.net> <4a6ae9fc-a52b-4300-0edb-a0f4169c314a@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <4a6ae9fc-a52b-4300-0edb-a0f4169c314a@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 31, 2019 at 02:55:01PM +0100, Vlastimil Babka wrote: > > + > > + /* > > + * Avoid if skipped recently. Ideally it would > > + * move to the tail but even safe iteration of > > + * the list assumes an entry is deleted, not > > + * reordered. > > + */ > > + if (get_pageblock_skip(freepage)) { > > + if (list_is_last(freelist, &freepage->lru)) > > + break; > > + > > + continue; > > + } > > + > > + /* Reorder to so a future search skips recent pages */ > > + move_freelist_tail(freelist, freepage); > > + > > + pfn = pageblock_start_pfn(free_pfn); > > + cc->fast_search_fail = 0; > > + set_pageblock_skip(freepage); > > + break; > > + } > > + > > + if (nr_scanned >= limit) { > > + cc->fast_search_fail++; > > + move_freelist_tail(freelist, freepage); > > + break; > > + } > > + } > > + spin_unlock_irqrestore(&cc->zone->lock, flags); > > + } > > + > > + cc->total_migrate_scanned += nr_scanned; > > + > > + /* > > + * If fast scanning failed then use a cached entry for a page block > > + * that had free pages as the basis for starting a linear scan. > > + */ > > + if (pfn == cc->migrate_pfn) > > + reinit_migrate_pfn(cc); > > This will set cc->migrate_pfn to the lowest pfn encountered, yet return > pfn initialized by original cc->migrate_pfn. > AFAICS isolate_migratepages() will use the returned pfn for the linear > scan and then overwrite cc->migrate_pfn with wherever it advanced from > there. So whatever we stored here into cc->migrate_pfn will never get > actually used, except when isolate_migratepages() returns with > ISOLATED_ABORT. > So maybe the infinite kcompactd loop is linked to ISOLATED_ABORT? > I'm not entirely sure it would fix the infinite loop. I suspect that is going to be a boundary conditions where the two scanners are close but do not meet if it still exists after the batch of fixes. However, you're right that this code is problematic. I'll write a fix, test it and post it if it's ok. Well spotted! -- Mel Gorman SUSE Labs