Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2202216iof; Tue, 7 Jun 2022 23:04:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwspC4uzVlwnOOGblxzMXSfbUcofb92MjVs86GYzd7eat5W19AY6+QX3OFLboaIvKyq/oSz X-Received: by 2002:a63:24d:0:b0:3fe:26a0:7bca with SMTP id 74-20020a63024d000000b003fe26a07bcamr2674354pgc.277.1654668271124; Tue, 07 Jun 2022 23:04:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654668271; cv=none; d=google.com; s=arc-20160816; b=SWlffERBRxoPZWK7FyqbxQIwvWUJYsKV9V9itD5GUfMXPMEFz20/iodWmoC4zfnpbL 4v9t6BVP5SxarfGSOvvzwUl9Tq4p/DQAUKtycKkp3tYS6DhFXufqqeCjtE09yu/iSm2g iosnZt0xTjHK2f+EQHmHuo23raIeOFdCyHZuvQdsN0rvVir7eT2Ummid60eS2TOQqfVv kt9LhByD4MnIy59JXoaXf8Bda5jjtaP2gg94vbdxfWtdVTWzuUCBYz8Su3CP1ljh5Odj /DFprtoPkJXwTJVVzxSRLPGBAcfueMVWbxmiSz+GImQW/EdCLq+yc+op5VkiR5m6x6PW Id4A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=K8AjIZWxMvs8QM4dGJprI93sxkJgzakuBQKqRiPx5+I=; b=v9FQ0lv8h0sE113yBs/B6SyCXHwlxR2XGt0H+QNiygGKWxlRYlgdRdQB8+nITnblPi zQea988ugC+8bNzMV99gautdemOxVadVAue2jGETSiv1Z7lKZLvyVC5hipGG6ayL3C9M UjvKk59ezvquz1GDnw0UjgwYheHPSuYTRpM23rYrGepQ4Eo30TaPa1yVHUQg/hOmch59 9ljuFpNFPM3NhdS+AYVYR4ausM/0riyFMQvRVL3Hp/QL0zxUQAnTymWjM3w95kqQEk0a zF4/8E/Jdae7z8RgVFxj3eTPvmFyNeVX+ZSjgycdZyzsyQcWco0s5AOK/mIMuzM7X/M5 k6Ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fGm1j5Hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id il6-20020a17090b164600b001df82539ad1si36121373pjb.54.2022.06.07.23.04.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 23:04:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fGm1j5Hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DD80A4506BA; Tue, 7 Jun 2022 22:34:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1390666AbiFHBvE (ORCPT + 99 others); Tue, 7 Jun 2022 21:51:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1383129AbiFGWTU (ORCPT ); Tue, 7 Jun 2022 18:19:20 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DC9FD19762D; Tue, 7 Jun 2022 12:20:46 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 2204F60906; Tue, 7 Jun 2022 19:20:36 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 2B1B6C341C0; Tue, 7 Jun 2022 19:20:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654629635; bh=EO8JBHw8FJVtlQsdM5QRvdHxzQHvifwHotLYtOSjkqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fGm1j5HzJUfR/BJAjzpGSwR4UaOFxfCrR0hgcR7F18XKmk4q7sfMaikdh3LyNZR47 wgyCpCEpItQSyqYBrRzvzvdQV28mZo374VYiIsqH4MxT9vHHG0hGxvC/3ZJDESa7mF HYPqwyVmgFROOvliTJOD8ja8X3ElCeRZihjL7cSk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rei Yamamoto , Miaohe Lin , Mel Gorman , Oscar Salvador , Don Dutile , Wonhyuk Yang , Andrew Morton Subject: [PATCH 5.18 760/879] mm, compaction: fast_find_migrateblock() should return pfn in the target zone Date: Tue, 7 Jun 2022 19:04:38 +0200 Message-Id: <20220607165024.924465598@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rei Yamamoto commit bbe832b9db2e1ad21522f8f0bf02775fff8a0e0e upstream. At present, pages not in the target zone are added to cc->migratepages list in isolate_migratepages_block(). As a result, pages may migrate between nodes unintentionally. This would be a serious problem for older kernels without commit a984226f457f849e ("mm: memcontrol: remove the pgdata parameter of mem_cgroup_page_lruvec"), because it can corrupt the lru list by handling pages in list without holding proper lru_lock. Avoid returning a pfn outside the target zone in the case that it is not aligned with a pageblock boundary. Otherwise isolate_migratepages_block() will handle pages not in the target zone. Link: https://lkml.kernel.org/r/20220511044300.4069-1-yamamoto.rei@jp.fujitsu.com Fixes: 70b44595eafe ("mm, compaction: use free lists to quickly locate a migration source") Signed-off-by: Rei Yamamoto Reviewed-by: Miaohe Lin Acked-by: Mel Gorman Reviewed-by: Oscar Salvador Cc: Don Dutile Cc: Wonhyuk Yang Cc: Rei Yamamoto Cc: Signed-off-by: Andrew Morton Signed-off-by: Greg Kroah-Hartman --- mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+) --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1858,6 +1858,8 @@ static unsigned long fast_find_migratebl update_fast_start_pfn(cc, free_pfn); pfn = pageblock_start_pfn(free_pfn); + if (pfn < cc->zone->zone_start_pfn) + pfn = cc->zone->zone_start_pfn; cc->fast_search_fail = 0; found_block = true; set_pageblock_skip(freepage);