From patchwork Sat Nov 20 00:43:15 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Morton X-Patchwork-Id: 12629915 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 31122C433FE for ; Sat, 20 Nov 2021 00:43:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A82916B0072; Fri, 19 Nov 2021 19:43:27 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id A32CE6B0073; Fri, 19 Nov 2021 19:43:27 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8F8756B0074; Fri, 19 Nov 2021 19:43:27 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0192.hostedemail.com [216.40.44.192]) by kanga.kvack.org (Postfix) with ESMTP id 827666B0072 for ; Fri, 19 Nov 2021 19:43:27 -0500 (EST) Received: from smtpin06.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id 479128CA2E for ; Sat, 20 Nov 2021 00:43:17 +0000 (UTC) X-FDA: 78827459634.06.3316977 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by imf04.hostedemail.com (Postfix) with ESMTP id 2CBE95000300 for ; Sat, 20 Nov 2021 00:43:15 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id D96A061A86; Sat, 20 Nov 2021 00:43:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1637368996; bh=2PQW+cdaN3G/EGtGuHO4fMMzrcTBi6OEz3+gQLOt9F0=; h=Date:From:To:Subject:In-Reply-To:From; b=fEf9uizsMrmiHNmKLET/EihaVTp53d1J5XE74V+C9xjFHLe0da2lv0vWjLQAu295V mGDSWg0m/fJQal/RWuqWc0BRZwxJSa/qWJ8QsS8srB9vk1t6ekX5SmpSv1h6llgkOB AdYu8TXID5pZGQ7TI3dgNm0vIn2Lu3PB2n3opvts= Date: Fri, 19 Nov 2021 16:43:15 -0800 From: Andrew Morton To: akpm@linux-foundation.org, hyc.lee@gmail.com, linkinjeon@kernel.org, linux-mm@kvack.org, mm-commits@vger.kernel.org, smfrench@gmail.com, stfrench@microsoft.com, torvalds@linux-foundation.org, willy@infradead.org Subject: [patch 01/15] mm/swap.c:put_pages_list(): reinitialise the page list Message-ID: <20211120004315.e4FX_Mwps%akpm@linux-foundation.org> In-Reply-To: <20211119164248.50feee07c5d2cc6cc4addf97@linux-foundation.org> User-Agent: s-nail v14.8.16 X-Stat-Signature: s6rkpc5pc5w84adq3okdw7addq1h54bi X-Rspamd-Queue-Id: 2CBE95000300 X-Rspamd-Server: rspam07 Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=linux-foundation.org header.s=korg header.b=fEf9uizs; spf=pass (imf04.hostedemail.com: domain of akpm@linux-foundation.org designates 198.145.29.99 as permitted sender) smtp.mailfrom=akpm@linux-foundation.org; dmarc=none X-HE-Tag: 1637368995-720109 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: From: Matthew Wilcox Subject: mm/swap.c:put_pages_list(): reinitialise the page list While free_unref_page_list() puts pages onto the CPU local LRU list, it does not remove them from the list they were passed in on. That makes the list_head appear to be non-empty, and would lead to various corruption problems if we didn't have an assertion that the list was empty. Reinitialise the list after calling free_unref_page_list() to avoid this problem. Link: https://lkml.kernel.org/r/YYp40A2lNrxaZji8@casper.infradead.org Fixes: 988c69f1bc23 ("mm: optimise put_pages_list()") Signed-off-by: Matthew Wilcox (Oracle) Reviewed-by: Steve French Reported-by: Namjae Jeon Tested-by: Steve French Tested-by: Namjae Jeon Cc: Steve French Cc: Hyeoncheol Lee Signed-off-by: Andrew Morton --- mm/swap.c | 1 + 1 file changed, 1 insertion(+) --- a/mm/swap.c~hitting-bug_on-trap-in-read_pages-mm-optimise-put_pages_list +++ a/mm/swap.c @@ -156,6 +156,7 @@ void put_pages_list(struct list_head *pa } free_unref_page_list(pages); + INIT_LIST_HEAD(pages); } EXPORT_SYMBOL(put_pages_list);