Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2158476iof; Tue, 7 Jun 2022 21:42:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyjpr5l/BEkP8aI8i0twE+zQyhMPIa24zLMEgqyWJxMdywivoNHFqo4Aso5h4vrbgQ5tTQL X-Received: by 2002:a17:902:9006:b0:167:5c8c:4d37 with SMTP id a6-20020a170902900600b001675c8c4d37mr21802457plp.109.1654663345753; Tue, 07 Jun 2022 21:42:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654663345; cv=none; d=google.com; s=arc-20160816; b=FZ8inyQzTOAbUyjb8Nu9RxP/BU1sgl55f8W/QgvvOXty0VF4+DvfB0gl3j5lLJZkhx toeXJu8hLIe+5sP2EAH7qWH8nSB4pga65JJd5BwXu9kO/C14OF+e0i9d18TE7KvY8Kor E0cwHty/AaPztF+0k2FhLzBcTrpDUZRq0WJbcd53jZCjR1w7AiIUtyL5uwulG77cm2sM aDDYPeeNllgxlbq3lvXkMO9iKdsf6m1p5wxftAbYKMnWfbXjPyTQ5m4yLwt7Bzdn+o9o IhOtCw2iXyXn0/Ri9qWj9i4j/jlP+/3U7y+/5eerQDP2X+V5aACpdzqautvkPL56YASu 3HLw== 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=PBEbXJb2n/qeifMtPYylO7tAA3qxXyyaiYfK0yhwMBE=; b=q1cEXSe/S4dpRdOztmZDUgjNYFmGrS/vmMHsbKmNb6QAF5FJvoS0+M1NZo+gyzwAju QeGuTFyw4zi3JVs/c0TgyRBHYPCK+P+BtCSvXDw4ZXJjxoaKD2SIJv9lNFJXEnaTNaJD QmojpMDl98Uuwv6gyIysqdPAFGW5E4iu5e7VZowWlM/p+kBKgaTUj7pCh5Dt5a2Lk82p N0NSLJK1i9K9nMULg6rPuvoffJnS+DnwkrFsmEyT3g8FNybr2BKfcACLtyOcA4pPryyH tkW4/VVKmbroACGuvzcieS5TureI8Wxmxzv5+m0dC3EEqiNO0FqEwBQa5nMdoEoX85Ps CHyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g8Ah2wBZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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. [23.128.96.19]) by mx.google.com with ESMTPS id y71-20020a638a4a000000b003fccd1c49easi26005070pgd.158.2022.06.07.21.42.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 21:42:25 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=g8Ah2wBZ; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 F0D1EED7B7; Tue, 7 Jun 2022 21:12:41 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349434AbiFGSDB (ORCPT + 99 others); Tue, 7 Jun 2022 14:03:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40500 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1348028AbiFGRoD (ORCPT ); Tue, 7 Jun 2022 13:44:03 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0152F106A72; Tue, 7 Jun 2022 10:35:17 -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 ams.source.kernel.org (Postfix) with ESMTPS id 78C40B822AD; Tue, 7 Jun 2022 17:35:17 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id DB5E6C385A5; Tue, 7 Jun 2022 17:35:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654623316; bh=p65ceeBw+FH2EMeKNkzSaxNHItzY2FJc3X2Ljx9/ocU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g8Ah2wBZly++NRXHEakQV8Cc9Cf1GJAdIxu6Czjpm/3JOXaXo4Aqt7fC6WJsuJVdF B9CjaPyTWrbV0QPWM41zxkTWwdm2ixZWu8dKBqZyRyfCY+uGgwAyj8fUNfy9Bv4QuB EnBrtsL2CnNVK/30cK3YDKQvPm9l8vJa5kP5jnuk= 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.10 371/452] mm, compaction: fast_find_migrateblock() should return pfn in the target zone Date: Tue, 7 Jun 2022 19:03:48 +0200 Message-Id: <20220607164919.621105442@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607164908.521895282@linuxfoundation.org> References: <20220607164908.521895282@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 @@ -1747,6 +1747,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);