On 3/8/26 12:24 PM, Usama Arif wrote:
On Fri, 6 Mar 2026 20:55:20 -0800 "JP Kobryn (Meta)" <[email protected]>
wrote:
[...]
+static void mpol_count_numa_alloc(struct mempolicy *pol, int intended_nid,
+ struct page *page, unsigned int order)
+{
+ int actual_nid = page_to_nid(page);
+ long nr_pages = 1L << order;
+ enum node_stat_item hit_idx;
+ struct mem_cgroup *memcg;
+ struct lruvec *lruvec;
+ bool is_hit;
+
+ if (!root_mem_cgroup || mem_cgroup_disabled())
+ return;
Hello JP!
The stats are exposed via /proc/vmstat and are guarded by CONFIG_NUMA, not
CONFIG_MEMCG. Early returning overhere would make it inaccuate. Does
it make sense to use mod_node_page_state if memcg is not available,
so that these global counters work regardless of cgroup configuration.
Good call. I can instead do:
if (!mem_cgroup_disabled() && root_mem_cgroup) {
struct mem_cgroup *memcg;
struct lruvec *lruvec;
/* use lruvec for updating stats */
} else {
/* use node for updating stats */
}
This should also take care of the bot warning on mem_cgroup_from_task()
not being available.