Re: [PATCH v4 2/4] mm: memcontrol: make obj_cgroup_memcg() handle NULL objcg
Shakeel Butt <[email protected]>
| Newsgroups | gmane.linux.kernel,gmane.linux.kernel.mm |
|---|---|
| Message-ID | <[email protected]> |
On Mon, Aug 17, 2026 at 05:03:26PM +0800, Qi Zheng wrote: > From: Qi Zheng <[email protected]> > > obj_cgroup_memcg() currently requires a non-NULL objcg, so callers that > may hold a NULL objcg must guard the call with an explicit NULL check. > This pattern is duplicated in folio_memcg(), folio_memcg_check(), > mm/page_owner.c, and mm/zswap.c. > > Teach obj_cgroup_memcg() to accept NULL and return NULL in that case, then > remove the redundant NULL checks at the call sites. Also remove the > mem_cgroup_from_entry() wrapper in zswap, which existed solely to provide > this NULL-safe behaviour, and replace its two callers with direct > obj_cgroup_memcg() calls. > > No functional change intended. > > Signed-off-by: Qi Zheng <[email protected]> Acked-by: Shakeel Butt <[email protected]>