Messages in this thread | | | From | Shakeel Butt <> | Date | Fri, 13 May 2022 10:23:36 -0700 | Subject | Re: [PATCH v2 6/6] zswap: memcg accounting |
| |
On Tue, May 10, 2022 at 8:29 AM Johannes Weiner <hannes@cmpxchg.org> wrote: > [...] > +void obj_cgroup_charge_zswap(struct obj_cgroup *objcg, size_t size) > +{ > + struct mem_cgroup *memcg; > + > + VM_WARN_ON_ONCE(!(current->flags & PF_MEMALLOC)); > + > + /* PF_MEMALLOC context, charging must succeed */ ) Instead of these warnings and comment why not just explicitly use memalloc_noreclaim_[save|restore]() ?
> + if (obj_cgroup_charge(objcg, GFP_KERNEL, size))
Can we please make this specific charging an opt-in feature or at least provide a way to opt-out? This will impact users/providers where swap is used transparently (in terms of memory usage). Also do you want this change for v1 users as well?
> + VM_WARN_ON_ONCE(1); > + > + rcu_read_lock(); > + memcg = obj_cgroup_memcg(objcg); > + mod_memcg_state(memcg, MEMCG_ZSWAP_B, size); > + mod_memcg_state(memcg, MEMCG_ZSWAPPED, 1); > + rcu_read_unlock(); > +} > +
| |