From 639aa224541100e5d85c0755fc54f688e4923e1c Mon Sep 17 00:00:00 2001 From: zhongjiang-ali Date: Wed, 4 Feb 2026 20:28:29 +0800 Subject: [PATCH] anolis: mm: clear I_KIDLED_YOUNG synchronously when shrink_slab ANBZ: #30476 shrink_slab will drop the reclaimable slab, but it failes to reclaim them because I_KIDLED_YOUNG flags prevent it to be released. I_KIDLED_YOUNG and I_REFERENCED is set synchronously, hence it also clear synchronously to avoid unexpected issue. Meanwhile, Modify the I_KIDLED_YOUNG flags value from int to UL, which avoid the overflow Fixes: fa73812bcafe ("anolis: mm: kidled: Add a new *KIDLED_YOUNG flag to replace *REFERENCED checking") Reviewed-by: Baolin Wang baolin.wang@linux.alibaba.com Signed-off-by: zhongjiang-ali --- fs/inode.c | 11 ++++------- include/linux/fs.h | 4 +++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/fs/inode.c b/fs/inode.c index f0e64ca413db..381236295c57 100644 --- a/fs/inode.c +++ b/fs/inode.c @@ -433,11 +433,8 @@ static void inode_lru_list_add(struct inode *inode) if (list_lru_add(&inode->i_sb->s_inode_lru, &inode->i_lru)) this_cpu_inc(nr_unused); else { - inode->i_state |= I_REFERENCED; -#ifdef CONFIG_KIDLED /* Keep KIDLED_YOUNG and REFERENCED set synchronously */ - inode->i_state |= I_KIDLED_YOUNG; -#endif + inode->i_state |= (I_REFERENCED | I_KIDLED_YOUNG); } } @@ -797,7 +794,7 @@ static enum lru_status inode_lru_isolate(struct list_head *item, * through the LRU as we canot reclaim them now. */ if (atomic_read(&inode->i_count) || - (inode->i_state & ~I_REFERENCED)) { + (inode->i_state & ~(I_REFERENCED | I_KIDLED_YOUNG))) { list_lru_isolate(lru, &inode->i_lru); spin_unlock(&inode->i_lock); this_cpu_dec(nr_unused); @@ -805,8 +802,8 @@ static enum lru_status inode_lru_isolate(struct list_head *item, } /* recently referenced inodes get one more pass */ - if (inode->i_state & I_REFERENCED) { - inode->i_state &= ~I_REFERENCED; + if (inode->i_state & (I_REFERENCED | I_KIDLED_YOUNG)) { + inode->i_state &= ~(I_REFERENCED | I_KIDLED_YOUNG); spin_unlock(&inode->i_lock); return LRU_ROTATE; } diff --git a/include/linux/fs.h b/include/linux/fs.h index f876989151ea..af7c3d4b80e4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2355,7 +2355,9 @@ static inline void kiocb_clone(struct kiocb *kiocb, struct kiocb *kiocb_src, #define I_LRU_ISOLATING (1 << __I_LRU_ISOLATING) #ifdef CONFIG_KIDLED -#define I_KIDLED_YOUNG (1 << 31) +#define I_KIDLED_YOUNG (1UL << 31) +#else +#define I_KIDLED_YOUNG 0 #endif #define I_DIRTY_INODE (I_DIRTY_SYNC | I_DIRTY_DATASYNC) -- Gitee