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: 13048009 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDD29C4332F for ; Fri, 18 Nov 2022 10:17:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6D8C76B0072; Fri, 18 Nov 2022 05:17:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 689236B0073; Fri, 18 Nov 2022 05:17:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 551006B0075; Fri, 18 Nov 2022 05:17:37 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 45FB36B0072 for ; Fri, 18 Nov 2022 05:17:37 -0500 (EST) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2845CA0AA7 for ; Fri, 18 Nov 2022 10:17:37 +0000 (UTC) X-FDA: 80146161354.11.348EF95 Received: from outbound-smtp47.blacknight.com (outbound-smtp47.blacknight.com [46.22.136.64]) by imf08.hostedemail.com (Postfix) with ESMTP id 8764416000F for ; Fri, 18 Nov 2022 10:17:36 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp47.blacknight.com (Postfix) with ESMTPS id 32F64FA7D2 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 ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1668766656; a=rsa-sha256; cv=none; b=XgMldKWGJU/w53pRT6NjgU8tweJ5M7QBQ9cKY6oSkefKTAtb3WThHCKnTRX0ErQAE7k16A v925XK/bkhScdlK/CwXqjGoHzmg6SPtUl7jjxlwjcxJAwcZ9K66qEfTqsPkt9d3PIq99Uf W9Qu89N9iWH83MWH0ycNkvGTqs+SZdA= ARC-Authentication-Results: i=1; imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.64 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1668766656; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KdSm7BloM6XAV0NZVdWTK0GO7g+qUM1tjh6RpcjUiXI=; b=FG7SJlG1eaWMdhmK1tcK7OmXA7VaVUOvIwjtnDlzxAILRDA5pREkxHvBG/JRaiXka9dyM8 uvjtVGpmD5XYJMaae1uF+guv/0rs5O4TJGVaBY8GKRd1O5q+PRAe2up//RK3V5LkyWsodL G9d4rumxB+Smd6lIxIC6h/2wf8bdBzg= X-Stat-Signature: 6zxh9gcedptko1saxirapcwempg1r1xa X-Rspamd-Queue-Id: 8764416000F Authentication-Results: imf08.hostedemail.com; dkim=none; spf=pass (imf08.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.136.64 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Rspam-User: X-Rspamd-Server: rspam06 X-HE-Tag: 1668766656-199287 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)