mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-08-31 14:04:27 -04:00
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>
This commit is contained in:
committed by
Andrew Morton
parent
3bf07ce805
commit
b64727d264
10
mm/vmscan.c
10
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;
|
||||
@@ -2119,7 +2125,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;
|
||||
|
||||
Reference in New Issue
Block a user