From patchwork Fri Nov 18 10:17:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 22253 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp105717wrr; Fri, 18 Nov 2022 02:19:42 -0800 (PST) X-Google-Smtp-Source: AA0mqf6y+DnndqvhB2JWYEZ9mwce1kP5BhEUA9tjwjwx5rxhaf8cbfTBtkviter45UJrB+FbMCLi X-Received: by 2002:a17:902:dc81:b0:186:59e9:20f6 with SMTP id n1-20020a170902dc8100b0018659e920f6mr7315470pld.39.1668766782247; Fri, 18 Nov 2022 02:19:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668766782; cv=none; d=google.com; s=arc-20160816; b=zsmB/JfEQtZVRhQdkvORDGlUPYpO/B9qGUfciI9i2xETqvSOGSul+RjSLfad2Z9yqd nFqtTTUDWc3QXQOyXahfdD5LWFB9fa+psPNPoCpz2A3a6KesJNFd/CMY41D1oj53KDCS M3BFZxWtNFjti99JAJR0Sg6qojT61AnrkdawAbA3NEoYn+m8GUYTWaHIaOjEG0M7S1fT yvWjzZpoVgdJ64sgfuVRjqZHlupCr+AMwlc6puWTCNH1rTsHS2KRqELEn5KZBacBVQLR aCADYAmjnz9mkJix3MZ0eHZ1bIsmIy8Yo1iPIJvRO7wPyEs0UyjZGKIZ6pXIUtl1C7BE /UmQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id me2-20020a17090b17c200b00213f8a9fd79si8493154pjb.130.2022.11.18.02.19.29; Fri, 18 Nov 2022 02:19:42 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749828797302745957?= X-GMAIL-MSGID: =?utf-8?q?1749828797302745957?= 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 Reviewed-by: Vlastimil Babka --- 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)