From patchwork Sun May 22 02:53:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hugh Dickins X-Patchwork-Id: 12858094 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 E5225C433EF for ; Sun, 22 May 2022 02:53:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 423B48D0009; Sat, 21 May 2022 22:53:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D3A38D0003; Sat, 21 May 2022 22:53:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C27C8D0009; Sat, 21 May 2022 22:53:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 19E438D0003 for ; Sat, 21 May 2022 22:53:09 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id D92C120A1E for ; Sun, 22 May 2022 02:53:08 +0000 (UTC) X-FDA: 79491857256.25.1AD1F3F Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by imf13.hostedemail.com (Postfix) with ESMTP id F2C2720002 for ; Sun, 22 May 2022 02:52:42 +0000 (UTC) Received: by mail-ot1-f54.google.com with SMTP id t14-20020a9d66ce000000b0060af9ed4b87so2753356otm.9 for ; Sat, 21 May 2022 19:53:07 -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=SPkZpdlLD/VHGk/CCPmKum0393r5PLNFzrafrEekp1pMcwi2kbQ/ERZtyb9nsdV+pB rtMrRuScAKxBytD39+CR8OP9wcVFynU3A6hhxXoV8NPwze1GRAcPgE+XsvQ2m9EyI/aT mRZby8qofMRT2/u9TkuUary3G/1Wv5uzEVWNw6E4dmoiLv2W/0D5vLz4tRfSQ0bWPHUY MWOQ5wYQnPZutV9FTXze96+KaGbr/h0D8fiM8/evNa8w4UIloajwpHgUI7rnd6BLO6eq dJxywFErYct16BonL0vzsZZOobJxTA8pGAN5bfocux/DvZBrhWPYbC7WQhw0s0oRI3nM DYfA== X-Gm-Message-State: AOAM530utUY7IwCw2nkjCKkWqBJcw9Kv7MJ4VCV9YWyydyJ/q9qDg/9V TSULahxTdQIuQQSMWAPb/CjX2Q== X-Google-Smtp-Source: ABdhPJy5KpGuqJaBa7R3JvaH0mDzSSHBpqtD43dtdjVjYzW9/w8dZRgHoFiwkPsy3qXUv/nF55utvg== 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 Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=d3eGHwfE; spf=pass (imf13.hostedemail.com: domain of hughd@google.com designates 209.85.210.54 as permitted sender) smtp.mailfrom=hughd@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Stat-Signature: djzi5b4ottuincs9pz93c9zepcbzwpnq X-Rspamd-Queue-Id: F2C2720002 X-Rspamd-Server: rspam01 X-HE-Tag: 1653187962-907638 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: 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 Reviewed-by: Miaohe Lin Tested-by: Miaohe Lin --- 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;