summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorBaolin Wang <baolin.wang@linux.alibaba.com>2026-07-20 19:12:01 +0800
committerAndrew Morton <akpm@linux-foundation.org>2026-07-27 18:33:36 -0700
commitb096a2e992339c147b4f311f398efec02a9ed276 (patch)
treeed2ec9aedcc21363c484b21c36a98915fa2c7c3e /mm
parent52900b20c3ab71836dd272f82a0e08fa962dde0c (diff)
downloadlinux-next-b096a2e992339c147b4f311f398efec02a9ed276.tar.gz
linux-next-b096a2e992339c147b4f311f398efec02a9ed276.zip
mm: vmscan: add a helper to identify file-backed executable folios
Add a helper to identify file-backed executable folios to avoid duplicate code. No functional changes. Link: https://lore.kernel.org/2ee74f9f98ac45a2f0db0ceb018e086bdb671d17.1784509721.git.baolin.wang@linux.alibaba.com Signed-off-by: Baolin Wang <baolin.wang@linux.alibaba.com> Acked-by: Johannes Weiner <hannes@cmpxchg.org> Reviewed-by: Axel Rasmussen <axelrasmussen@google.com> Reviewed-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Kairui Song <kasong@tencent.com> Reviewed-by: Barry Song <baohua@kernel.org> Cc: Harry Yoo <harry@kernel.org> Cc: Jann Horn <jannh@google.com> Cc: Lance Yang <lance.yang@linux.dev> Cc: Liam R. Howlett <liam@infradead.org> Cc: Lorenzo Stoakes <ljs@kernel.org> Cc: Michal Hocko <mhocko@kernel.org> Cc: Rik van Riel <riel@surriel.com> Cc: Shakeel Butt <shakeel.butt@linux.dev> Cc: Vlastimil Babka <vbabka@kernel.org> Cc: Wei Xu <weixugc@google.com> Cc: Yuanchu Xie <yuanchu@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/vmscan.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/mm/vmscan.c b/mm/vmscan.c
index 03720756938a..89ee818e704f 100644
--- a/mm/vmscan.c
+++ b/mm/vmscan.c
@@ -268,6 +268,12 @@ static int sc_swappiness(struct scan_control *sc, struct mem_cgroup *memcg)
}
#endif
+static inline bool is_exec_file_folio(const struct folio *folio,
+ const vma_flags_t *vma_flags)
+{
+ return vma_flags_test(vma_flags, VMA_EXEC_BIT) && folio_is_file_lru(folio);
+}
+
static void set_task_reclaim_state(struct task_struct *task,
struct reclaim_state *rs)
{
@@ -914,7 +920,7 @@ static enum folio_references folio_check_references(struct folio *folio,
/*
* Activate file-backed executable folios after first usage.
*/
- if (vma_flags_test(&vma_flags, VMA_EXEC_BIT) && folio_is_file_lru(folio))
+ if (is_exec_file_folio(folio, &vma_flags))
return FOLIOREF_ACTIVATE;
return FOLIOREF_KEEP;
@@ -2117,7 +2123,7 @@ static void shrink_active_list(unsigned long nr_to_scan,
* IO, plus JVM can create lots of anon VM_EXEC folios,
* so we ignore them here.
*/
- if (vma_flags_test(&vma_flags, VMA_EXEC_BIT) && folio_is_file_lru(folio)) {
+ if (is_exec_file_folio(folio, &vma_flags)) {
nr_rotated += folio_nr_pages(folio);
list_add(&folio->lru, &l_active);
continue;