Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6771628pxb; Wed, 17 Feb 2021 13:01:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJwW7vAun6z7jbrGXYtNBgKn1qfNeAA9gFOwGk6cLHt+40KMmhR6xAGl5Y3zsyYFuHB5h3CM X-Received: by 2002:aa7:ce8a:: with SMTP id y10mr675143edv.77.1613595717347; Wed, 17 Feb 2021 13:01:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613595717; cv=none; d=google.com; s=arc-20160816; b=NAfMFiRFx9qQrfLxVSsO4XINpts6jo6thHcAQDMEgUnGx/544OkAAWhzmxwXg5tQw1 tZzKeOPIvV4buf/gvSE+JhYene8pYmikSzqC81GTdVHrVYWMcXh4D3Qj4iFHCCtpslog JBStCwCx/NQk9voZ5bZtU7S5I/wsh5nX6P9LIuJyS8sGoBl0ueEi7dbt/Ds5hKM0NQza erxyTrB3fkTP6T0rNZacZxlVYzW1Djy2u/avqAvU1a/00zkW+gEVhK89s5Qw36v24EJ3 UhExCvS6RGBU5tme7JRcETnclbYQq94Vl6T+KM4BIV6mnZd+csY0dUxXuafL715ZDZyP rduw== 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; bh=yKLAq+ayCEAJjgTGRFR4n6yFln/G5YqxfEvgjFtAQrw=; b=JhQZsBirdsdVnHD6S3w9Rd8kG/ZoTP95nj3lODTeoVCMZ25BHTCEcKQ+dbSQb8fDwx IMJsyZI2xuKuC+Hs3qgyNp3S9G4/7xwCht5DD7thTovBBLtNuHaYbZCJBp4/Zi0lqBzy 6zy0yWWjMm6nYLkmDWvRx/6/AJnlr+j5IxoqZjcE8eqGQodB/gy68Dwm6fD5GiyHwhp2 l23w3H5Dp7R6I2kodPlz+yr+aoWsZ84hmIBIoYzb+9SJOviUUCOwfeypJ45ECb7j/nT6 hyi+hsQWHpyt3fsVn5ZXWG2D80FkKvBnmnoClTDuyUwSy72vj9vzSMyF6lWlBE4fk9fe sMLA== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i4si2082840ejg.595.2021.02.17.13.01.33; Wed, 17 Feb 2021 13:01:57 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234970AbhBQSvP (ORCPT + 99 others); Wed, 17 Feb 2021 13:51:15 -0500 Received: from outbound-smtp55.blacknight.com ([46.22.136.239]:35219 "EHLO outbound-smtp55.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232565AbhBQSvL (ORCPT ); Wed, 17 Feb 2021 13:51:11 -0500 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id 7AAE9FA8EE for ; Wed, 17 Feb 2021 18:50:17 +0000 (GMT) Received: (qmail 21941 invoked from network); 17 Feb 2021 18:50:17 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 17 Feb 2021 18:50:17 -0000 Date: Wed, 17 Feb 2021 18:50:16 +0000 From: Mel Gorman To: Vlastimil Babka Cc: linux-mm@kvack.org, Andrew Morton , linux-kernel@vger.kernel.org, Andrea Arcangeli , David Hildenbrand , Michal Hocko , Mike Rapoport , stable@vger.kernel.org Subject: Re: [PATCH] mm, compaction: make fast_isolate_freepages() stay within zone Message-ID: <20210217185015.GF3697@techsingularity.net> References: <20210217173300.6394-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20210217173300.6394-1-vbabka@suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Feb 17, 2021 at 06:33:00PM +0100, Vlastimil Babka wrote: > Compaction always operates on pages from a single given zone when isolating > both pages to migrate and freepages. Pageblock boundaries are intersected with > zone boundaries to be safe in case zone starts or ends in the middle of > pageblock. The use of pageblock_pfn_to_page() protects against non-contiguous > pageblocks. > > The functions fast_isolate_freepages() and fast_isolate_around() don't > currently protect the fast freepage isolation thoroughly enough against these > corner cases, and can result in freepage isolation operate outside of zone > boundaries: > > - in fast_isolate_freepages() if we get a pfn from the first pageblock of a > zone that starts in the middle of that pageblock, 'highest' can be a pfn > outside of the zone. If we fail to isolate anything in this function, we > may then call fast_isolate_around() on a pfn outside of the zone and there > effectively do a set_pageblock_skip(page_to_pfn(highest)) which may currently > hit a VM_BUG_ON() in some configurations > - fast_isolate_around() checks only the zone end boundary and not beginning, > nor that the pageblock is contiguous (with pageblock_pfn_to_page()) so it's > possible that we end up calling isolate_freepages_block() on a range of pfn's > from two different zones and end up e.g. isolating freepages under the wrong > zone's lock. > > This patch should fix the above issues. > > Fixes: 5a811889de10 ("mm, compaction: use free lists to quickly locate a migration target") Acked-by: Mel Gorman -- Mel Gorman SUSE Labs