From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 480AAC433DB for ; Wed, 17 Feb 2021 18:50:21 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id E075964E62 for ; Wed, 17 Feb 2021 18:50:20 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E075964E62 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 84B508D0002; Wed, 17 Feb 2021 13:50:20 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 823058D0001; Wed, 17 Feb 2021 13:50:20 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 73A818D0002; Wed, 17 Feb 2021 13:50:20 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0086.hostedemail.com [216.40.44.86]) by kanga.kvack.org (Postfix) with ESMTP id 5899C8D0001 for ; Wed, 17 Feb 2021 13:50:20 -0500 (EST) Received: from smtpin15.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id 1C8BD3653 for ; Wed, 17 Feb 2021 18:50:20 +0000 (UTC) X-FDA: 77828650200.15.pan41_390d12d2764e Received: from filter.hostedemail.com (10.5.16.251.rfc1918.com [10.5.16.251]) by smtpin15.hostedemail.com (Postfix) with ESMTP id E8BA11814B0C1 for ; Wed, 17 Feb 2021 18:50:19 +0000 (UTC) X-HE-Tag: pan41_390d12d2764e X-Filterd-Recvd-Size: 3151 Received: from outbound-smtp55.blacknight.com (outbound-smtp55.blacknight.com [46.22.136.239]) by imf06.hostedemail.com (Postfix) with ESMTP for ; Wed, 17 Feb 2021 18:50:18 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp55.blacknight.com (Postfix) with ESMTPS id 7B5B0FA8EF 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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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