Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1508012pxu; Sat, 5 Dec 2020 20:35:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJyYQv9dXKvfi3IkYfe+wKUZwHDP3grbe9iQ6jK2rtLUR+auUaR69J95DRQQ2cq+5EXNT+X+ X-Received: by 2002:a17:906:68c4:: with SMTP id y4mr14140170ejr.332.1607229328614; Sat, 05 Dec 2020 20:35:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607229328; cv=none; d=google.com; s=arc-20160816; b=SF5DdJ+og2kvIrvXOZY2cSSRHD5xQDgLkejDURQaK8fFP5z9SEmkJNTrBvXW/Z8f6z Vc+vWYjirGjXb1tQmA0FqSYWu7pOLlKSsC9DQ5d1LiBVcOYLQ5DU4/+txfOPH8X+yI9B PXwjNtTgeNOQQ4jYcgbBLLZSCn86YI5TOSujmLDo7RnKPI7/dNtlFmwXH5csCEdMXTqW uL9b+Eiej3amqwEoRmx2Up1UKJmhKOseq0xTZAKfU1X6SL6bNagJpJAtDuGBB07d+x0X cWzupOZI7ZsMnb68tFi0/qew+opBbzKj/8lKNG+thQZTSbPeARGDsZqZb/F3//lANUDR n/Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=th8Piry8zr8jwmBoGNyqaz39iFHmvQLMDYj54glntZ8=; b=qGub/MOMoGMMSf6uiTsBBh996a3Ss4IWAaOwlbWj5bQhQpeiP7yt3ESHMyRR5pzP3i +91dLUw3qI3/ROFMB5/DD2/WOioBHcNiA6kSw1+FCia3NVaoKt9Dw+yU3utcXRjl1QAd vsRQ2VMUuMwDPyIh1h8OQKS4lyoLZFM6qROClOXEerrWOarhOZUj6sYMyslGSL2WFEkR 4WvevMn+H5dsrmml9sXPUMrGn78ot1MdHdK60HqDuL5kdHD6IJnwRySzJ8wPK6nodCfH IYC85uCrGUApqhn5sgCdAdFBHnF5oTk0MD8IMhSvkCT/JjrKF3CEY/uWmgAKLHDDyGBB ysaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QtT+lCFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gj15si4459281ejb.597.2020.12.05.20.35.05; Sat, 05 Dec 2020 20:35:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=QtT+lCFl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726222AbgLFE3l (ORCPT + 99 others); Sat, 5 Dec 2020 23:29:41 -0500 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:41332 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725866AbgLFE3k (ORCPT ); Sat, 5 Dec 2020 23:29:40 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1607228893; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=th8Piry8zr8jwmBoGNyqaz39iFHmvQLMDYj54glntZ8=; b=QtT+lCFlmBA86kR6L5VWINxnBPmVLwlhTHPnzmG8hgD9KdLire/j3wJ/FvDX+lObMvwVoj wBDt4ZaFeBJlkdiXVlqQjZzcPL7NF9ObDFJ/f801XXMjD0l5Nowz+i+713vSZN1ydmPoRc 5VBw+4AdwpwiXitJM/loRzYbS/ON3/A= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-250-Vg5t3QcrM3e4NKAa7b-xbA-1; Sat, 05 Dec 2020 21:26:54 -0500 X-MC-Unique: Vg5t3QcrM3e4NKAa7b-xbA-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 5839380363C; Sun, 6 Dec 2020 02:26:53 +0000 (UTC) Received: from mail (ovpn-112-148.rdu2.redhat.com [10.10.112.148]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 06E565D9D5; Sun, 6 Dec 2020 02:26:48 +0000 (UTC) Date: Sat, 5 Dec 2020 21:26:47 -0500 From: Andrea Arcangeli To: Mel Gorman Cc: Vlastimil Babka , Andrew Morton , linux-mm@kvack.org, Qian Cai , Michal Hocko , David Hildenbrand , linux-kernel@vger.kernel.org, Mike Rapoport , Baoquan He Subject: Re: [PATCH 1/1] mm: compaction: avoid fast_isolate_around() to set pageblock_skip on reserved pages Message-ID: References: <8C537EB7-85EE-4DCF-943E-3CC0ED0DF56D@lca.pw> <20201121194506.13464-1-aarcange@redhat.com> <20201121194506.13464-2-aarcange@redhat.com> <20201124133205.GK3306@suse.de> <20201125103053.GL3306@suse.de> <20201126104720.GO3306@suse.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201126104720.GO3306@suse.de> User-Agent: Mutt/2.0.2 (2020-11-20) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Mel, On Thu, Nov 26, 2020 at 10:47:20AM +0000, Mel Gorman wrote: > Agreed. This thread has a lot of different directions in it at this > point so what I'd hope for is first, a patch that initialises holes with > zone/node linkages within a 1<<(MAX_ORDER-1) alignment. If there is a > hole, it would be expected the pages are PageReserved. Second, a fix to > fast_isolate that forces PFNs returned to always be within the stated > zone boundaries. The last two patches should resolve the struct page initialization https://git.kernel.org/pub/scm/linux/kernel/git/andrea/aa.git/ and the VM_BUG_ON_PAGE never happened again as expected. So I looked back to see how the "distance" logic is accurate. I added those checks and I get negative hits: diff --git a/mm/compaction.c b/mm/compaction.c index cc1a7f600a86..844a90b0acdf 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1331,6 +1331,12 @@ fast_isolate_freepages(struct compact_control *cc) low_pfn = pageblock_start_pfn(cc->free_pfn - (distance >> 2)); min_pfn = pageblock_start_pfn(cc->free_pfn - (distance >> 1)); + WARN_ON_ONCE((long) low_pfn < 0); + WARN_ON_ONCE((long) min_pfn < 0); + if ((long) low_pfn < 0) + return cc->free_pfn; + if ((long) min_pfn < 0) + return cc->free_pfn; if (WARN_ON_ONCE(min_pfn > low_pfn)) low_pfn = min_pfn; Both warn-on-once triggers, so it goes negative. While it appears not kernel crashing since pfn_valid won't succeed on negative entries and they'll always be higher than any pfn in the freelist, is this sign that there's further room for improvement here? Thanks, Andrea