summaryrefslogtreecommitdiffstats
path: root/mm/damon/paddr.c
diff options
context:
space:
mode:
authorSeongJae Park <sj@kernel.org>2023-03-04 19:39:49 +0000
committerAndrew Morton <akpm@linux-foundation.org>2023-03-07 17:04:55 -0800
commitdd52a61da0dd8bab8b90e808f0e5ad507b61ad6d (patch)
tree7b0321a912f1a9766bc7e6090bedc458d5df5ba9 /mm/damon/paddr.c
parent751688b8be9049f558f86982966ecaa61a9cbedf (diff)
downloadlinux-dd52a61da0dd8bab8b90e808f0e5ad507b61ad6d.tar.gz
linux-dd52a61da0dd8bab8b90e808f0e5ad507b61ad6d.tar.bz2
linux-dd52a61da0dd8bab8b90e808f0e5ad507b61ad6d.zip
mm/damon/paddr: fix folio_nr_pages() after folio_put() in damon_pa_mark_accessed_or_deactivate()
damon_pa_mark_accessed_or_deactivate() is accessing a folio via folio_nr_pages() after folio_put() for the folio has invoked. Fix it. Link: https://lkml.kernel.org/r/20230304193949.296391-3-sj@kernel.org Fixes: f70da5ee8fe1 ("mm/damon: convert damon_pa_mark_accessed_or_deactivate() to use folios") Signed-off-by: SeongJae Park <sj@kernel.org> Reviewed-by: Kefeng Wang <wangkefeng.wang@huawei.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Cc: Vishal Moola (Oracle) <vishal.moola@gmail.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm/damon/paddr.c')
-rw-r--r--mm/damon/paddr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/damon/paddr.c b/mm/damon/paddr.c
index 49b267b03305..dd9c33fbe805 100644
--- a/mm/damon/paddr.c
+++ b/mm/damon/paddr.c
@@ -280,8 +280,8 @@ static inline unsigned long damon_pa_mark_accessed_or_deactivate(
folio_mark_accessed(folio);
else
folio_deactivate(folio);
- folio_put(folio);
applied += folio_nr_pages(folio);
+ folio_put(folio);
}
return applied * PAGE_SIZE;
}