On Mon, Sep 02, 2024 at 03:21:12PM +0800, alexs@xxxxxxxxxx wrote: > And keep the memcg_data member, since as Yosry pointed out: > "When the pages are freed, put_page() -> folio_put() -> __folio_put() > will call mem_cgroup_uncharge(). The latter will call folio_memcg() > (which reads folio->memcg_data) to figure out if uncharging needs to > be done. ... why does that mean we need to keep memcg_data in this definition? If it's unused, it will stay unused. > There are also other similar code paths that will check > folio->memcg_data. It is currently expected to be present for all > folios. So until we have custom code paths per-folio type for > allocation/freeing/etc, we need to keep folio->memcg_data present and > properly initialized." ... > +struct zpdesc { > + unsigned long flags; > + struct list_head lru; > + struct movable_operations *mops; Hm. I'm not sure this is a wise definition. While yes, we know it will only point to the mops, we always set the bottom two bits to '10'. So I think it's safer to make this 'unsigned long mops' and force people to _not_ use it directly.