From patchwork Thu Dec 19 07:30:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13914585 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 E155DE77184 for ; Thu, 19 Dec 2024 07:30:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 736636B00A1; Thu, 19 Dec 2024 02:30:25 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 6D8736B00A7; Thu, 19 Dec 2024 02:30:25 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5065C6B00A4; Thu, 19 Dec 2024 02:30:25 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 2445B6B0089 for ; Thu, 19 Dec 2024 02:30:25 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 837F01A14A8 for ; Thu, 19 Dec 2024 07:30:24 +0000 (UTC) X-FDA: 82910884014.01.AAAC36A Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf06.hostedemail.com (Postfix) with ESMTP id 6D7C0180012 for ; Thu, 19 Dec 2024 07:29:59 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=P6VVKt2L; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1734593398; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=dA/uo5tghpmaqVajoyvSrLkgzd8pWgdsOMRxw06MACI=; b=gF8NZoQ/MM44sNcD3q/s7yrnvXDdJDkAdbU9+RzYzp2tuqB/9EoAdDIKFNspkiMln4u768 4gIVcFPcPBG8Rtmm9Andm0vZhBwDhlPYQcwVH8i4BjPiraCdv94EiQ0E7X+s4dt9RUL4Zx 953HN2G8sZ12QL+Hu0uS/dnxpXwlFeE= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=pass header.d=linux.alibaba.com header.s=default header.b=P6VVKt2L; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1734593398; a=rsa-sha256; cv=none; b=J6RGQkKWukLqssfXBOg8dRcrVD7GAdHg4N8G4CkSyeaKYZ6ECTOheNx4KnudCmxjqxU5Sb OoPh2TMhtwblaf/lEtoM17FEv94mmiqVDuqeMjfUrqdX/2exBG6J6N8hGqVSxzEqF3zNxo 5RBP8jlXJ0/NEdk7gxgnUsLjg9vK1Zo= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1734593419; h=From:To:Subject:Date:Message-Id:MIME-Version; bh=dA/uo5tghpmaqVajoyvSrLkgzd8pWgdsOMRxw06MACI=; b=P6VVKt2L1a4rINlkoSrkC4Y3m4A8M5uQHZ90DiXCXrALDbr9gvEcTwbo0/lEQyYh4znyEGTA0S7j+K4DJUhuTe/PtIyIHts6JJ/BtynGUCcjcQfRyC7xx7PM9rySbCVua5GCQ5oxXCdfteI+bfPSVNAcUadRBqI2kV6zWgyEC8U= Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0WLpQrub_1734593416 cluster:ay36) by smtp.aliyun-inc.com; Thu, 19 Dec 2024 15:30:16 +0800 From: Baolin Wang To: akpm@linux-foundation.org, hughd@google.com Cc: david@redhat.com, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/2] mm: shmem: fix the update of 'shmem_falloc->nr_unswapped' Date: Thu, 19 Dec 2024 15:30:09 +0800 Message-Id: X-Mailer: git-send-email 2.39.3 In-Reply-To: <77d8ef76a7d3d646e9225e9af88a76549a68aab1.1734593154.git.baolin.wang@linux.alibaba.com> References: <77d8ef76a7d3d646e9225e9af88a76549a68aab1.1734593154.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 X-Rspamd-Queue-Id: 6D7C0180012 X-Rspamd-Server: rspam12 X-Stat-Signature: p7ipyqbfu79763m93q3tbu7ju38xmc5t X-Rspam-User: X-HE-Tag: 1734593399-938328 X-HE-Meta: U2FsdGVkX1/IpoIpdaXkj+Vf7arzR4ADvbG5buZ86xZZ2SRECt6TFqYNKLu7fX33vEP5T9Zn7RHwMoLy/QyUP15887JCPL+WFMTHGNdffrFmcqHePuJiAXFv/dPsqiS3wmMdYuu2jMms2kUcLl5ZFD1bb6cFoTuwymTX/fqlSQ1XBAtZQhiZtU4MitB5jkt7VgXdrKxtowAc3NA/VeCjv4ht4O5u1l6EAZYLfLHzKP8+cWOi8lxvedkvRaeMep657oGN4mLk0bvvc0n2yxUcn7l7QZd6pYLQb5Y84W/nANKAVO2ESJzAzLcLfsjR0QTQO5KHEOj0GIhH1PhHdi8yeCBz1EvGOlRBpmWgraUufPnuX20HIhW/hUzj2tBBPezb2TGqdHo/TQ83MXfzlcMYyTYZpJqpS7DxL1OgD6zsDiOjvGL4T4ybBHVGN38HbL0Jnq4ovWjqinOPTOQs/gf7F6ASoYtvPriTuRNPDFMolWfb0qav9PhSz+wwjcFJ3nKcJgdNIKqzN9EMBirNlaX0Ykyz5bAe4MNTwSKUg3n20uqlFKXCecyr9PakPYVB7ZuLEpvb63ZbDi8d5cMpodEIAkzjdflO7cN5cwKN4IPZzGIG1yvudfRj0i2s3qVWHALLSuqvblCUMgip5Uud+qJyjPk0/EGO/hof/clBh/k5tYLOR0hGOmaZkjLEDxNMnmmmxOVcplXXkaiyBOBOyb31UyIdW9RHIkJv4FDmL0S5JM13V1uFNxv/OfU8jd9TdL6kVmv3cH4aCU36MvxWqhPDf7JYFmIVCABT7xPHI7BHwysup80pYhkIcxJsLvsCfl7NcSfiALnF+R2UBgin/y8KUX7wW0BftRJeiHOH04jOn2HZoOUZZoweRqtAZdCb1QsbNHlTJfCv4pg2SkiIjsKnKetmI4eKjiptrOJpBiXiisJWO8vFduMM/mS2jTgOz3+ROGVwykoP24VFOz0pFJf NQkX7uPe oR5IJ4zGOCFNve8hFlrIy1vf/4v69TxS0agScBVPHQ49q14U9v5ekKqa+/mLs3hpjVWdA3HwAMMww4MomBx/ClCG1f9nOGa3BlBjn6aUqMpT7iFKMFItbwB5w/jxwCkYEvQXfHs2LNeJN6FsA0AOliUqUg3qgegk+ho1blcsMMw3n7ZB5TnO4MTKx4oAmfdNZTGq0wFLSgOaF07HIVV3X/djXNePJ+/IotT61IgG4sMoL8hb2yfi+Pg0D4F8pPr+XoAYgmwzEaNLvmR0= X-Bogosity: Ham, tests=bogofilter, spamicity=0.036826, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The 'shmem_falloc->nr_unswapped' is used to record how many writepage refused to swap out because fallocate() is allocating, but after shmem supports large folio swap out, the update of 'shmem_falloc->nr_unswapped' does not use the correct number of pages in the large folio, which may lead to fallocate() not exiting as soon as possible. Anyway, this is found through code inspection, and I am not sure whether it would actually cause serious issues. Fixes: 809bc86517cc ("mm: shmem: support large folio swap out") Signed-off-by: Baolin Wang --- mm/shmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/shmem.c b/mm/shmem.c index dec659e84562..ac58d4fb2e6f 100644 --- a/mm/shmem.c +++ b/mm/shmem.c @@ -1535,7 +1535,7 @@ static int shmem_writepage(struct page *page, struct writeback_control *wbc) !shmem_falloc->waitq && index >= shmem_falloc->start && index < shmem_falloc->next) - shmem_falloc->nr_unswapped++; + shmem_falloc->nr_unswapped += nr_pages; else shmem_falloc = NULL; spin_unlock(&inode->i_lock);