summaryrefslogtreecommitdiff
path: root/mm/shmem.c
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linux.alibaba.com>2024-12-19 15:30:09 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2025-01-09 13:33:52 +0100
commitcabacb18a42db34bc676d1922e34bcbdbf1b2daa (patch)
tree43693fe41f1225013bb39f5f29f607e831c97a39 /mm/shmem.c
parent3647932d0b3e609c762c55e8f9fe10a09776e0a7 (diff)
downloadlinux-cabacb18a42db34bc676d1922e34bcbdbf1b2daa.tar.gz
linux-cabacb18a42db34bc676d1922e34bcbdbf1b2daa.tar.bz2
linux-cabacb18a42db34bc676d1922e34bcbdbf1b2daa.zip
mm: shmem: fix the update of 'shmem_falloc->nr_unswapped'
commit d77b90d2b2642655b5f60953c36ad887257e1802 upstream. 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. Link: https://lkml.kernel.org/r/f66a0119d0564c2c37c84f045835b870d1b2196f.1734593154.git.baolin.wang@linux.alibaba.com Fixes: 809bc86517cc ("mm: shmem: support large folio swap out") Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Acked-by: David Hildenbrand <david@redhat.com> Cc: Hugh Dickins <hughd@google.com> Cc: <stable@vger.kernel.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r--mm/shmem.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/shmem.c b/mm/shmem.c
index b03ced0c3d48..21ef93c92b47 100644
--- a/mm/shmem.c
+++ b/mm/shmem.c
@@ -1527,7 +1527,7 @@ try_split:
!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);