Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp988825pxb; Wed, 6 Apr 2022 06:08:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxMMhsiOJvgyVF+r1Hlq0dbxpqS6R6pRjrFmgD3yyCGy2bjVgPCH32eAbfaAMxLI8m5lP4Z X-Received: by 2002:a63:35c1:0:b0:386:3620:3c80 with SMTP id c184-20020a6335c1000000b0038636203c80mr6945711pga.327.1649250491427; Wed, 06 Apr 2022 06:08:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649250491; cv=none; d=google.com; s=arc-20160816; b=mcPzMSgDnUFn65Dvi1R7xoAtxTPNYGmRbRiwIwaWyUWpmD63x7iOwox4wWjqC3O1AA U0UfGDoFQNPe9XeIQD8wKBKbXPx/7WJQHK1dp9A8keqPUL31yhv8UrC9H1ewFlwqoYqZ +23x6r5ICaYzARw3BxsRyFjXvwGMAzodziG92YuPldM4TZC8cisV+czoJkLk5bd3e+di WYXYLwafg5PGrKPQg633hCZPoHV3DWDqWcxSCmLQqeBOtUfzxlgXG7FZ+XZa+0XUJjdZ 90SENniExVuDxjMCmdc59Z5P2UWtIxwXFM53wgWXg3mG/RJfJyvwq9FsRtfrNGLtVIsO CNIQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=ldv1eTdvRcDb1gdQzp3Y4Zy9srflJw1n9GOhdpNL4S0=; b=pjY5E2eG5zZsaDjWbtViPWzvWQMsxjAgcHMRm7R8tK4l0gok4O2UEhFpA5syUL/nH5 v0fK9Ndckx80StpGG9GRTe9Jh8aXZXUkF8RjfANNWWSoA9jMoL62UyGgMyPnw6AVIO5S x57qDYBjj9b+f9x/FSsvjLmxH8jeF3Mjpai15lrcwnADqAU4OLK8J3Zd+zC0wrp26/vW i0f9OSxI6UnAWbpCMCsqKg2dR/cVwSZEcdIKvOAcfs/L1ZoTl7Lory/FfZ9cYASe5W8O nZsvGwnemwc+c3vZP5XtAn+midnq8sgdEBBKOXuIoaTqehaRYYXHexeQ6qrjO2ziTGl9 ks8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xbYtaQyV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id s5-20020a637705000000b003816043eee4si15774100pgc.217.2022.04.06.06.08.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 06:08:11 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xbYtaQyV; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from out1.vger.email (out1.vger.email [IPv6:2620:137:e000::1:20]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1CF374754AE; Wed, 6 Apr 2022 03:30:57 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1392010AbiDEUGo (ORCPT + 99 others); Tue, 5 Apr 2022 16:06:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55966 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345131AbiDEKkp (ORCPT ); Tue, 5 Apr 2022 06:40:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E80032DD64; Tue, 5 Apr 2022 03:26:01 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 84F9E6141D; Tue, 5 Apr 2022 10:26:01 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 96867C385A1; Tue, 5 Apr 2022 10:26:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1649154361; bh=8pB0J7RuG+0VRdERB0M6sy0avVjZh9WeAccoMSSevQo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xbYtaQyVEhGFO1nJZn81yrIAETQyR9tO+NxDP6tQQRFtWFTPKyq+/Yei62TFQxYdv r1aGpHWnR1ket4t0SwGYGe2atac4DQoEA7EQH2aEO1NfDPqnvAlWxRZpkvox8Dp//F KTohWCEX2T+dE0cLQ/jgN4byjDK8kVzkM+WrPX1U= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Hugh Dickins , "Matthew Wilcox (Oracle)" Subject: [PATCH 5.10 552/599] XArray: Update the LRU list in xas_split() Date: Tue, 5 Apr 2022 09:34:06 +0200 Message-Id: <20220405070315.267256065@linuxfoundation.org> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220405070258.802373272@linuxfoundation.org> References: <20220405070258.802373272@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 From: Matthew Wilcox (Oracle) commit 3ed4bb77156da0bc732847c8c9df92454c1fbeea upstream. When splitting a value entry, we may need to add the new nodes to the LRU list and remove the parent node from the LRU list. The WARN_ON checks in shadow_lru_isolate() catch this oversight. This bug was latent until we stopped splitting folios in shrink_page_list() with commit 820c4e2e6f51 ("mm/vmscan: Free non-shmem folios without splitting them"). That allows the creation of large shadow entries, and subsequently when trying to page in a small page, we will split the large shadow entry in __filemap_add_folio(). Fixes: 8fc75643c5e1 ("XArray: add xas_split") Reported-by: Hugh Dickins Signed-off-by: Matthew Wilcox (Oracle) Signed-off-by: Greg Kroah-Hartman --- lib/xarray.c | 2 ++ 1 file changed, 2 insertions(+) --- a/lib/xarray.c +++ b/lib/xarray.c @@ -1080,6 +1080,7 @@ void xas_split(struct xa_state *xas, voi xa_mk_node(child)); if (xa_is_value(curr)) values--; + xas_update(xas, child); } else { unsigned int canon = offset - xas->xa_sibs; @@ -1094,6 +1095,7 @@ void xas_split(struct xa_state *xas, voi } while (offset-- > xas->xa_offset); node->nr_values += values; + xas_update(xas, node); } EXPORT_SYMBOL_GPL(xas_split); #endif