Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

memcg-v1: no need for memcg locking for writeback tracking

During the era of memcg charge migration, the kernel has to be make
sure that the writeback stat updates do not race with the charge
migration. Otherwise it might update the writeback stats of the wrong
memcg. Now with the memcg charge migration gone, there is no more race
for writeback stat updates and the previous locking can be removed.

Link: https://lkml.kernel.org/r/20241025012304.2473312-5-shakeel.butt@linux.dev
Signed-off-by: Shakeel Butt <shakeel.butt@linux.dev>
Acked-by: Michal Hocko <mhocko@suse.com>
Reviewed-by: Roman Gushchin <roman.gushchin@linux.dev>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Muchun Song <muchun.song@linux.dev>
Cc: Yosry Ahmed <yosryahmed@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Shakeel Butt and committed by
Andrew Morton
568bcf41 a8cd9d4c

-4
-4
mm/page-writeback.c
··· 3083 3083 struct address_space *mapping = folio_mapping(folio); 3084 3084 bool ret; 3085 3085 3086 - folio_memcg_lock(folio); 3087 3086 if (mapping && mapping_use_writeback_tags(mapping)) { 3088 3087 struct inode *inode = mapping->host; 3089 3088 struct backing_dev_info *bdi = inode_to_bdi(inode); ··· 3113 3114 lruvec_stat_mod_folio(folio, NR_WRITEBACK, -nr); 3114 3115 zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, -nr); 3115 3116 node_stat_mod_folio(folio, NR_WRITTEN, nr); 3116 - folio_memcg_unlock(folio); 3117 3117 3118 3118 return ret; 3119 3119 } ··· 3125 3127 3126 3128 VM_BUG_ON_FOLIO(folio_test_writeback(folio), folio); 3127 3129 3128 - folio_memcg_lock(folio); 3129 3130 if (mapping && mapping_use_writeback_tags(mapping)) { 3130 3131 XA_STATE(xas, &mapping->i_pages, folio_index(folio)); 3131 3132 struct inode *inode = mapping->host; ··· 3165 3168 3166 3169 lruvec_stat_mod_folio(folio, NR_WRITEBACK, nr); 3167 3170 zone_stat_mod_folio(folio, NR_ZONE_WRITE_PENDING, nr); 3168 - folio_memcg_unlock(folio); 3169 3171 3170 3172 access_ret = arch_make_folio_accessible(folio); 3171 3173 /*