Skip to content

Commit 82d7e59

Browse files
Chen Ridonghtejun
authored andcommitted
cgroup: switch to css_is_online() helper
Use the new css_is_online() helper that has been introduced to check css online state, instead of testing the CSS_ONLINE flag directly. This improves readability and centralizes the state check logic. No functional changes intended. Signed-off-by: Chen Ridong <chenridong@huawei.com> Acked-by: Shakeel Butt <shakeel.butt@linux.dev> Reviewed-by: Jan Kara <jack@suse.cz> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 50133c0 commit 82d7e59

5 files changed

Lines changed: 6 additions & 6 deletions

File tree

fs/fs-writeback.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ void wbc_account_cgroup_owner(struct writeback_control *wbc, struct folio *folio
981981

982982
css = mem_cgroup_css_from_folio(folio);
983983
/* dead cgroups shouldn't contribute to inode ownership arbitration */
984-
if (!(css->flags & CSS_ONLINE))
984+
if (!css_is_online(css))
985985
return;
986986

987987
id = css->id;

include/linux/memcontrol.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -893,7 +893,7 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg)
893893
{
894894
if (mem_cgroup_disabled())
895895
return true;
896-
return !!(memcg->css.flags & CSS_ONLINE);
896+
return css_is_online(&memcg->css);
897897
}
898898

899899
void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru,

kernel/cgroup/cgroup.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4948,7 +4948,7 @@ bool css_has_online_children(struct cgroup_subsys_state *css)
49484948

49494949
rcu_read_lock();
49504950
css_for_each_child(child, css) {
4951-
if (child->flags & CSS_ONLINE) {
4951+
if (css_is_online(child)) {
49524952
ret = true;
49534953
break;
49544954
}
@@ -5753,7 +5753,7 @@ static void offline_css(struct cgroup_subsys_state *css)
57535753

57545754
lockdep_assert_held(&cgroup_mutex);
57555755

5756-
if (!(css->flags & CSS_ONLINE))
5756+
if (!css_is_online(css))
57575757
return;
57585758

57595759
if (ss->css_offline)

mm/memcontrol.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ ino_t page_cgroup_ino(struct page *page)
281281
/* page_folio() is racy here, but the entire function is racy anyway */
282282
memcg = folio_memcg_check(page_folio(page));
283283

284-
while (memcg && !(memcg->css.flags & CSS_ONLINE))
284+
while (memcg && !css_is_online(&memcg->css))
285285
memcg = parent_mem_cgroup(memcg);
286286
if (memcg)
287287
ino = cgroup_ino(memcg->css.cgroup);

mm/page_owner.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -530,7 +530,7 @@ static inline int print_page_owner_memcg(char *kbuf, size_t count, int ret,
530530
if (!memcg)
531531
goto out_unlock;
532532

533-
online = (memcg->css.flags & CSS_ONLINE);
533+
online = css_is_online(&memcg->css);
534534
cgroup_name(memcg->css.cgroup, name, sizeof(name));
535535
ret += scnprintf(kbuf + ret, count - ret,
536536
"Charged %sto %smemcg %s\n",

0 commit comments

Comments
 (0)