提交 f579b6f9 编写于 作者: X Xu Yu

alinux: kidled: make kidled_inc_page_age return latest page age

fix #26416752

The idle page age shown in idle_page_stats is one scan period behind the
theoretical idle age.  The cause is that kidled_inc_page_age returned
the ancient value, instead of the latest value, which leads to not
accounting in corresponding memcg.

This makes kidled_inc_page_age return the increased age of the page,
i.e., the latest page age, when KIDLED_AGE_NOT_IN_PAGE_FLAGS is not set.
Signed-off-by: NXu Yu <xuyu@linux.alibaba.com>
Reviewed-by: NXunlei Pang <xlpang@linux.alibaba.com>
Reviewed-by: NYang Shi <yang.shi@linux.alibaba.com>
上级 30496217
......@@ -75,9 +75,10 @@ int kidled_inc_page_age(pg_data_t *pgdat, unsigned long pfn)
if (age >= KIDLED_AGE_MASK)
break;
age++;
new = old = page->flags;
new &= ~(KIDLED_AGE_MASK << KIDLED_AGE_PGSHIFT);
new |= (((age + 1) & KIDLED_AGE_MASK) << KIDLED_AGE_PGSHIFT);
new |= ((age & KIDLED_AGE_MASK) << KIDLED_AGE_PGSHIFT);
} while (unlikely(cmpxchg(&page->flags, old, new) != old));
return age;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册