Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp6816806pxb; Wed, 17 Feb 2021 14:28:30 -0800 (PST) X-Google-Smtp-Source: ABdhPJxq8NTQw0FfvTY2OraRNo7Racw6fXBv7bpWfkYv7qCYOffEBJ1H3K+4SY0KHx4auVIjUTVX X-Received: by 2002:a05:6402:100b:: with SMTP id c11mr948680edu.193.1613600910710; Wed, 17 Feb 2021 14:28:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613600910; cv=none; d=google.com; s=arc-20160816; b=WBCGtImPpyy/reAal8i9bPRJm1TlHpim49N/iix6dnYSpYf2euI1noqOPf86J8cNjV 9g51E9bm+r2NY9IQfWbYLVHwutsDk9Wx0gcz+U/5XMZgP76IfddfJ61a/XLgQj/13fnL +DP9Z6BIXgu4lktAd0/2XgBqYXSbYLznoJv006aJGC3Vcxxh6qHRNlM9eiYTTVYIreqh /3bDoGrgAL8R2tVTaIzOPQEWxxXy8at7LUhrDmDsN1EM13HQ4pisGZC95edxRv1ERRfr C0SQLz504vKkxAgqor7GA1SU8Ab/6uPBj37MmeuwFJGwmvtQ4ZJCyq7/uWH99qza0z+m 2b9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:message-id:in-reply-to :subject:cc:to:from:date:dkim-signature; bh=Gi5brysudot778XfmQVyx+aFXT8IJ2mHpa0FTPkL6QA=; b=qcvhWFIfCGtvwO2C7DJ4KnDdV9xCVvo5dJUIH443IrcgIz5FYog2h24hADYDpZd3w7 EmNla/mEzDVhAig3W66Yf9Y5MECMM2AzsUerVgdqoDKLn8nlcF5b5XmZG6yUg03yg5d+ R6YjAXt7mY7NDPJ/PzKDA4e+d09imjqnYr14RhwWmIvdyoJQCD402AR+1jMEjHMNfpmx nKkni0D8WJXeTUwnI6S8XPVtFCL1F6pqghROEAzyJzL1ms4Nkdv5YL02csuVaoPcDCDf WUeqc0O+AHE312YbYl3CCTszTLbzDCbOR/0ulnULtapBA49pgR1Zw36ubH1kmybxTBBW 0maw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=JDl2MhLC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l2si2356181ede.232.2021.02.17.14.28.06; Wed, 17 Feb 2021 14:28:30 -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=@google.com header.s=20161025 header.b=JDl2MhLC; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234089AbhBQSRn (ORCPT + 99 others); Wed, 17 Feb 2021 13:17:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41062 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233242AbhBQSRk (ORCPT ); Wed, 17 Feb 2021 13:17:40 -0500 Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 69FBEC061574 for ; Wed, 17 Feb 2021 10:17:00 -0800 (PST) Received: by mail-pg1-x52a.google.com with SMTP id a4so7408511pgc.11 for ; Wed, 17 Feb 2021 10:17:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :mime-version; bh=Gi5brysudot778XfmQVyx+aFXT8IJ2mHpa0FTPkL6QA=; b=JDl2MhLCKhOanylnBiOEISbmJ/fonCREql9eNZHng2H7QwzVFaolfNg+s/F0hE+eQI cir2nRyVipOFEdPTN776AvYbVQCj4y+QZ1IfarCboeoTw30HyqCHN28Cklg5UeKtQzO3 K+nUCfCVrBslJkoW4kIw6wJDhHd5BTn7DGOb+XZJTcNK1leoU0WHZ6+oshreIlUjc46A BEdYP0Wh1g76zpGnNwbZPPyzYIyQKDBaUpHuUgsWMRdgpuvBl4+9+rXzvFC3qc6Oh1o1 UnplyjT1+j5iWUEHy1a2es5vbA27tH0vPIXN6VJotGrnqYQOWnpg8DhwV94t+buCqPn2 ilwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:mime-version; bh=Gi5brysudot778XfmQVyx+aFXT8IJ2mHpa0FTPkL6QA=; b=SojAoWlQIbOZUX8wMlCc4/Bx9HdsmXwLd6OEmQhkbwDwerANnMQCSvuaZmYECCBZs+ phkyzufhvsih8ijQEYM3hr9rwXy3w/aw1rwFvABb4RuvWWV+dpcUNE03qpkOV+zae0MI W19K5IotHoAF6MeLTG/9CF5Cp0Bgq4ZG7U+bQQXICk/nuQOkR7yBNKErxkbzbI2b2gMu 1hHGc72kDwUu5hxtJh71Jz9b/PvE+JFZKRbcZlsgh24U078q0aaCQA20aFToW+qyNJCB 6Qfdo/MMHmqOssl7pOiWqpWzBufwmLJJPbgSpPmN9ItU0/h590wg1LiEGuzgUszx3zjw wjXA== X-Gm-Message-State: AOAM532ysv+5lJpJ/X0aN0rRn164d2KMwUVkKJ6+JOCLBSLjPgtcY5Zj lRWcrfrJIAdkwUwZ41RZT7A6hg== X-Received: by 2002:a63:a0d:: with SMTP id 13mr560363pgk.130.1613585819166; Wed, 17 Feb 2021 10:16:59 -0800 (PST) Received: from [2620:15c:17:3:984e:d574:ca36:ce3c] ([2620:15c:17:3:984e:d574:ca36:ce3c]) by smtp.gmail.com with ESMTPSA id j73sm3295845pfd.170.2021.02.17.10.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 17 Feb 2021 10:16:58 -0800 (PST) Date: Wed, 17 Feb 2021 10:16:57 -0800 (PST) From: David Rientjes To: Vlastimil Babka cc: linux-mm@kvack.org, Mel Gorman , 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 In-Reply-To: <20210217173300.6394-1-vbabka@suse.cz> Message-ID: References: <20210217173300.6394-1-vbabka@suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 17 Feb 2021, 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") > Cc: > Signed-off-by: Vlastimil Babka Acked-by: David Rientjes