Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp368137rwb; Fri, 18 Nov 2022 02:38:33 -0800 (PST) X-Google-Smtp-Source: AA0mqf7wTXAWskXuOqVCbiXy29qk/1hzYVgFvSAZJ5Pg34IOEQNEs3WnLF5TzCM+gatIj1UZySgK X-Received: by 2002:a63:4302:0:b0:439:3ca0:5a29 with SMTP id q2-20020a634302000000b004393ca05a29mr6007816pga.443.1668767913453; Fri, 18 Nov 2022 02:38:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668767913; cv=none; d=google.com; s=arc-20160816; b=BQjGn1fAe3tmPBCZP1B8gBi31aBdjQQWMj+xZBOkQvTE1WMcpRckehHsxg/OAYNtV1 qtNze68RTUpuCN5I849vH3hh1/klJ7ODi6XzyIubiK5FXrrYD9Hn4bpPtnQnMWaGjCGo xOvVYV9UeKmYstXL2fr7HqqHYJFNGMXl/6TjhWOMYEzUSfKwXPPnYSDufJvx6s0bOOpO YHAQxOay7zZr6OOPRgLVwW+gi06hIGTaY9AdfSg3EVHVCl/Aye/iGDaAEtYEAX1XkxvD EtvWzDr9WY0iWb6dVE5Un2+yhxusUIL19I3esqPBD4bzxtBse/YVhMhQZFLohVgUWDcC yWFg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=KdSm7BloM6XAV0NZVdWTK0GO7g+qUM1tjh6RpcjUiXI=; b=CM5iOol2JjGz8SIxAZSP+PiA8Wk50ieRTq9I6/zeBZtDM6cQPv91C+11h1YE8HBJV6 QLrsPgatXR7pzz7vkNfxTvsQd20itHpDOdRuh+WclEshEtE6WUznk6XfvoDLcnnMBuyV ZfyxPLry5hw/u82h1rcHF/9b4sz8sTZ+UFeIwD4JsLEahfr7lrLUKsIygVWjteSX3agr qQCsZbUl9Z6H6qpun9kWYBYPHo67JPhXeh/euzDnvlS5jiFKR8k7agmUqpea+8Ho08yI /BBauWEnNgSyurq4OFK6fQkCg7l3FZwnQtXFX1pGiuVewApefTBOvUYFjc6o7XdAYiG1 sK5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id lk3-20020a17090b33c300b001fe2de6a2c9si3986190pjb.4.2022.11.18.02.38.09; Fri, 18 Nov 2022 02:38:33 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241383AbiKRKRl (ORCPT + 91 others); Fri, 18 Nov 2022 05:17:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46046 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241435AbiKRKRi (ORCPT ); Fri, 18 Nov 2022 05:17:38 -0500 Received: from outbound-smtp29.blacknight.com (outbound-smtp29.blacknight.com [81.17.249.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A846153F for ; Fri, 18 Nov 2022 02:17:36 -0800 (PST) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp29.blacknight.com (Postfix) with ESMTPS id 2883ABEC19 for ; Fri, 18 Nov 2022 10:17:35 +0000 (GMT) Received: (qmail 3723 invoked from network); 18 Nov 2022 10:17:35 -0000 Received: from unknown (HELO morpheus.112glenside.lan) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPA; 18 Nov 2022 10:17:34 -0000 From: Mel Gorman To: Andrew Morton Cc: Hugh Dickins , Yu Zhao , Vlastimil Babka , Marcelo Tosatti , Michal Hocko , Marek Szyprowski , LKML , Linux-MM , Mel Gorman Subject: [PATCH 1/2] mm/page_alloc: Always remove pages from temporary list Date: Fri, 18 Nov 2022 10:17:13 +0000 Message-Id: <20221118101714.19590-2-mgorman@techsingularity.net> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20221118101714.19590-1-mgorman@techsingularity.net> References: <20221118101714.19590-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS autolearn=ham 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 free_unref_page_list() has neglected to remove pages properly from the list of pages to free since forever. It works by coincidence because list_add happened to do the right thing adding the pages to just the PCP lists. However, a later patch added pages to either the PCP list or the zone list but only properly deleted the page from the list in one path leading to list corruption and a subsequent failure. As a preparation patch, always delete the pages from one list properly before adding to another. On its own, this fixes nothing although it adds a fractional amount of overhead but is critical to the next patch. Reported-by: Hugh Dickins Signed-off-by: Mel Gorman --- mm/page_alloc.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/page_alloc.c b/mm/page_alloc.c index 218b28ee49ed..1ec54173b8d4 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c @@ -3546,6 +3546,8 @@ void free_unref_page_list(struct list_head *list) list_for_each_entry_safe(page, next, list, lru) { struct zone *zone = page_zone(page); + list_del(&page->lru); + /* Different zone, different pcp lock. */ if (zone != locked_zone) { if (pcp) -- 2.35.3