From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A84AF3F44D3 for ; Mon, 20 Jul 2026 11:12:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=115.124.30.98 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545939; cv=none; b=PoMjcIjxWVwnqWfTP5L3kBG0rDJJIpJG7o+lRAEY/BjUoybm7l7G0jjTUsTAALLmfxY7KAjpSaAC+uxVgJU4+OCsbaZ2di5fB9Dt1B42ocW39vRCh8Sp+gjIHuEHn79f8wzUOPxtZhwNEPbCepN3ke/JF3mDIRBbJZquzv2F/3Y= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784545939; c=relaxed/simple; bh=rCzJV0ETmhGhJnsf/SyTQn1Z9CHQ2Mn4YoKB8Any4mQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=taqTTwSkePK6mKFu0kGQj2MoCvNxhv844CIYW93C6EcfTeVN6dxHJOZB7L66ccZpcGWa1b/XLfaoeSlZaUThSS3PZ18k4N2dMHMXbeZICmSjjOOQykL/1FFylXsTA/EAk0knE4L6LV83ktbIQUAbuPq4WzvAIw0FlQOEjwsyzyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b=Eud/wBbB; arc=none smtp.client-ip=115.124.30.98 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.b="Eud/wBbB" DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1784545933; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=qKLNv9nPUB641uxGT2XoWRnvBcDasFEpS3y3304Rfn4=; b=Eud/wBbBA1nMIdBN/MfU/gB2G2nIJenm2H0l4E/wkctunTzbWJULXaP+bzTCqI+hMgbnKFQ2RA3DB10pO5QUGTglH+X8iqCAVFhf3JH/nOjKlEaqzVDwo/ws/PkLKjbC9SlMZ6V9Sftw4ZwCk55sfrZ/nzP8l2dBcrZxyUEwWa0= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R391e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033045098064;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=21;SR=0;TI=SMTPD_---0X7THEvy_1784545930; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0X7THEvy_1784545930 cluster:ay36) by smtp.aliyun-inc.com; Mon, 20 Jul 2026 19:12:11 +0800 From: Baolin Wang To: akpm@linux-foundation.org, david@kernel.org, ljs@kernel.org, hannes@cmpxchg.org Cc: riel@surriel.com, liam@infradead.org, vbabka@kernel.org, harry@kernel.org, jannh@google.com, lance.yang@linux.dev, kasong@tencent.com, qi.zheng@linux.dev, shakeel.butt@linux.dev, baohua@kernel.org, axelrasmussen@google.com, yuanchu@google.com, weixugc@google.com, mhocko@kernel.org, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 2/3] mm: vmscan: add a helper to identify file-backed executable folios Date: Mon, 20 Jul 2026 19:12:01 +0800 Message-ID: <2ee74f9f98ac45a2f0db0ceb018e086bdb671d17.1784509721.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.43.5 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a helper to identify file-backed executable folios to avoid duplicate code. No functional changes. Signed-off-by: Baolin Wang Acked-by: Johannes Weiner Reviewed-by: Axel Rasmussen --- mm/vmscan.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mm/vmscan.c b/mm/vmscan.c index 11357b86ba2c..8f0c31a4848e 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; -- 2.47.3