From nobody Tue Apr 14 22:47:16 2026 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4558C04A68 for ; Sat, 30 Jul 2022 04:25:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239832AbiG3EZ3 (ORCPT ); Sat, 30 Jul 2022 00:25:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34546 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229464AbiG3EZ1 (ORCPT ); Sat, 30 Jul 2022 00:25:27 -0400 Received: from casper.infradead.org (casper.infradead.org [IPv6:2001:8b0:10b:1236::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4B21F120BC for ; Fri, 29 Jul 2022 21:25:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=Content-Transfer-Encoding:MIME-Version: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:In-Reply-To:References; bh=9lqr4PZyWhD9hoFrN8Igs1ekeXOVn9WRDM3RAtHu+m4=; b=GO350Yww1jvAcuN5cW7i9E+80D IevaHjyT3LMi+gQp86ckipKcHO9hrd3zQL5ATa40FEpHyiiKJq5rqRZsRk1u6573QzTQ9qnuDafBj 6DpjRjx7AdzExR0+5nZiJqe090RVn8Pxot71K2Jr7FokOdT2NJdXaiVt/RB3jBhhQIu51oDzbMiAY p1kW9NMe1VmRjk0iGqg4uLlHxZ5FNhJ2Cc/qDVHxXp69cmNSjcNlF4C//E6RfMYX8kfOHEAE/CK8H tn1a3sN8dCpAI+25JpKWNP31HFrwBfAJfckWIuc3wly7v5avp209TYbckU4NlyKQmlomazF66hshi 5WSZv4kA==; Received: from willy by casper.infradead.org with local (Exim 4.94.2 #2 (Red Hat Linux)) id 1oHe2T-005J2C-HY; Sat, 30 Jul 2022 04:25:21 +0000 From: "Matthew Wilcox (Oracle)" To: Hugh Dickins , Andrew Morton Cc: "Matthew Wilcox (Oracle)" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH] shmem: Update folio if shmem_replace_page() updates the page Date: Sat, 30 Jul 2022 05:25:18 +0100 Message-Id: <20220730042518.1264767-1-willy@infradead.org> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If we allocate a new page, we need to make sure that our folio matches that new page. This will be solved by changing shmem_replace_page() to shmem_replace_folio(), but this is the minimal fix. Fixes: da08e9b79323 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin= _folio()") Signed-off-by: Matthew Wilcox (Oracle) Acked-by: Hugh Dickins Reviewed-by: William Kucharski --- mm/shmem.c | 1 + 1 file changed, 1 insertion(+) diff --git a/mm/shmem.c b/mm/shmem.c index a6f565308133..bcc0a3c7b5bf 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1771,6 +1771,7 @@ static int shmem_swapin_folio(struct inode *inode, pg= off_t index, =20 if (shmem_should_replace_folio(folio, gfp)) { error =3D shmem_replace_page(&page, gfp, info, index); + folio =3D page_folio(page); if (error) goto failed; } --=20 2.35.1