On Mon, May 6, 2024 at 12:18 PM David Hildenbrand <david@xxxxxxxxxx> wrote: > > On 06.05.24 20:52, Yosry Ahmed wrote: > > On Mon, May 6, 2024 at 11:35 AM David Hildenbrand <david@xxxxxxxxxx> wrote: > >> > >> On 06.05.24 19:00, Yosry Ahmed wrote: > >>> Do not use __lruvec_stat_mod_folio() when updating NR_FILE_PMDMAPPED and > >>> NR_SHMEM_PMDMAPPED as these stats are not maintained per-memcg. Use > >>> __mod_node_page_state() instead, which updates the global per-node stats > >>> only. > >> > >> What's the effect of this? IIUC, it's been that way forever, no? > > > > Yes, but it has been the case that all the NR_VM_EVENT_ITEMS stats > > were maintained per-memcg, although some of those fields are not > > exposed anywhere. > > > > Shakeel recently added commit14e0f6c957e39 ("memcg: reduce memory for > > the lruvec and memcg stats"), which changed this such that we only > > maintain the stats we actually expose per-memcg (via a translation > > table). > > Valuable information we should add to the patch description :) > > > > > He also added commit 514462bbe927b ("memcg: warn for unexpected events > > and stats"), which warns if we try to update a stat per-memcg that we > > do not maintain per-memcg (i.e. the warning firing here). The goal is > > to make sure the translation table has all the stats it needs to have. > > > > Both of these commits were just merged today into mm-stable, hence the > > need for the fix now. It is the warning working as intended. No Fixes > > or CC stable are needed, but if necessary I would think: > > WARN* should usually be "Fixes:"d, because WARN* expresses a condition > that shouldn't be happening. > > Documentation/process/coding-style.rst contains details. > > > > > Fixes: 514462bbe927b ("memcg: warn for unexpected events and stats") > > > > , because without the warning, the stat update will just be ignored. > > So if anything the warning should have been added *after* this was > > fixed up. > > Ideally, yes. But if it's in mm-stable, we usually can no longer > reshuffle patches (commit IDs stable). I will send v2 shortly with the missing negative sign, amended commit log, and the Fixes tag. Thanks for taking a look! > -- > Cheers, > > David / dhildenb > >