Received: by 2002:ac2:464d:0:0:0:0:0 with SMTP id s13csp3276141lfo; Mon, 23 May 2022 00:29:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJztEbYeQ0wEUkU2eRbknSfmBRfJxiZKrYQkuODapFGTm4a0OKi1ko41r6wAY+i684yn9Wy6 X-Received: by 2002:a17:90b:11d1:b0:1df:9cbf:87a9 with SMTP id gv17-20020a17090b11d100b001df9cbf87a9mr25530157pjb.39.1653290971312; Mon, 23 May 2022 00:29:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653290971; cv=none; d=google.com; s=arc-20160816; b=Wzne8u1npeQtO4adj8IO0BjM9FSjhmomN67rkppwqadqw++z6IswsS2dXy4f+hzJxa +GxAZxXS+s21c7iM6xtCrPIcytZ9LUZ2ezt49Sc3pXeSYlYKvgtbJERLHQ60zuwdSy48 kyEFSd8TRX/XzjZIS5BgpOXa4Uh/MVe6yi2MfnduuDmNIoUvF5RpjsNYL+vCqRlm/nSe maN2CSG0FMNUcQEQe5ACwU96yQrdh8dfdTrjnhJgHnrV4ExTlNtL6eEdUV7VfjFAN0IX R8L0jPNq12pUKvUt3GH/ATgwiqOLoNM6la3Mo79G+XmToX1HxPxSTGRzcvL5jAHwhWfP NU7w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:subject:cc:to:from:date :dkim-signature; bh=v1DAiFT2xmj9A/ks1haZtydUQ187WcFyouSbatKulP8=; b=TRzPX7zhHgStAjTNBXNEM0BrAr20XX0x0zfgCzxdk2i1oHHEyvuIqOqUIzOykNr/HX FvGkwMlLWzFbqXXZztrzEaFyOEb7KocBIgt47o8WXhvCIEQ8skV8h1ry3WyzEabOTvou rzjN33UyLkERN1qyj+pZY9hiNuFo5TpmIni2Zj788CcXhe3nrzoMC2WaRAWm2JhrQ2dx CgBiPQqrISZL7RL2u3XUxb48gZZ4oCeKd97sBWjbetIvGBtN+KkRcatzB2FtBlkdl4Vy WmTj72HyU5q1MjJTiEJhqYZl3c3kdsQVdKY0dK3nLhgjLBxkdUbJaTwi1XcpSC6CsVDH NN+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d3eGHwfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c4-20020a170903234400b00161574728dasi10773287plh.493.2022.05.23.00.29.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 00:29:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=d3eGHwfE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ADDCE4EDF2; Sun, 22 May 2022 23:42:20 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236717AbiEVCxL (ORCPT + 99 others); Sat, 21 May 2022 22:53:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34866 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230406AbiEVCxK (ORCPT ); Sat, 21 May 2022 22:53:10 -0400 Received: from mail-ot1-x331.google.com (mail-ot1-x331.google.com [IPv6:2607:f8b0:4864:20::331]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 146F63F308 for ; Sat, 21 May 2022 19:53:08 -0700 (PDT) Received: by mail-ot1-x331.google.com with SMTP id s23-20020a9d7597000000b0060ae566f9a1so5350196otk.1 for ; Sat, 21 May 2022 19:53:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:mime-version; bh=v1DAiFT2xmj9A/ks1haZtydUQ187WcFyouSbatKulP8=; b=d3eGHwfEmP1AiPm26xG/Rv8vyfZDXL8vNOK8N7oRyC60AcCO/0LmcAWsGMGKEiWVoE RPdu2qCj8qkfrnfPC5DWsFSK2hNczcMiEqv2gwENlDhlc78IfgxBVkR9xcm2CrVHpQCx KmRc7AYe8E5I2NG4Ozdl1s9A6J+d8X/jOv15oLYHPW4k+3SfakJcLvSU8/cSf0DebH8C 9ZtT7p9mH3y6IZ9BLa+p+cLmrG5tuhXY9X2D0+dQ6RnaBPOcA8Rwmhhn7/Jbx6mLwAQb ND8Pk7QjfX/atfPFwc6XrB1YD9r1y23LZVZmVFjp7K+6/pcRZCM4DasyX/CjHC4yPGj4 MB4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version; bh=v1DAiFT2xmj9A/ks1haZtydUQ187WcFyouSbatKulP8=; b=UIAeXwjWOvHRhY/RkhojFwCkMVZKu4I0MyqSZJqvApVx+ArHqMvE/f/0sa9HPIrcUJ k23uJ4efpSU045nXMR+9tg8gqZcIK/rX89D0BkBT2qhmZj3Mx2i2etE0JLb+YwkkZ89m mpTmQMqLWC5m+yv+xlYtBTKe/Z/2hDzn358kLsl/0jnBvX3R7xeHpFWakvRuwkck/aDS 77OH+qhjE7CKtUC7Gpxrh4QVoJXizs+GhBrbPcPaPlUEjt4VvFzUkGRxeFl8PfMXnwXK NfOuqyAnqc2K4n7VrQr8KwbJzYCmnCIzMLnPyAgw33fJn+2ISWAunQkSzV6REbDNnehm +LYA== X-Gm-Message-State: AOAM531LPirxIg5xi57d3GyZrttTeCEu9DXZ2ZGCtLfpaTMVYXXb7X+s xUpfJadoFEiIMseQsTUZDOTPZRcQzDKYsw== X-Received: by 2002:a9d:6f89:0:b0:606:c2ec:66e0 with SMTP id h9-20020a9d6f89000000b00606c2ec66e0mr6445332otq.36.1653187987247; Sat, 21 May 2022 19:53:07 -0700 (PDT) Received: from ripple.attlocal.net (172-10-233-147.lightspeed.sntcca.sbcglobal.net. [172.10.233.147]) by smtp.gmail.com with ESMTPSA id v23-20020a9d5a17000000b0060603221268sm2696581oth.56.2022.05.21.19.53.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 21 May 2022 19:53:06 -0700 (PDT) Date: Sat, 21 May 2022 19:53:04 -0700 (PDT) From: Hugh Dickins X-X-Sender: hugh@ripple.anvils To: Matthew Wilcox cc: Andrew Morton , linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [PATCH next] mm/shmem: fix shmem folio swapoff hang Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-9.5 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE, USER_IN_DEF_DKIM_WL 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 Shmem swapoff makes no progress: the index to indices is not incremented. But "ret" is no longer a return value, so use folio_batch_count() instead. Fixes: da08e9b79323 ("mm/shmem: convert shmem_swapin_page() to shmem_swapin_folio()") Signed-off-by: Hugh Dickins --- mm/shmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1171,7 +1171,6 @@ static int shmem_find_swap_entries(struc XA_STATE(xas, &mapping->i_pages, start); struct folio *folio; swp_entry_t entry; - unsigned int ret = 0; rcu_read_lock(); xas_for_each(&xas, folio, ULONG_MAX) { @@ -1189,7 +1188,7 @@ static int shmem_find_swap_entries(struc if (swp_type(entry) != type) continue; - indices[ret] = xas.xa_index; + indices[folio_batch_count(fbatch)] = xas.xa_index; if (!folio_batch_add(fbatch, folio)) break;