Re: [PATCH 01/20] mm/zsmalloc: add zpdesc memory descriptor for zswap.zpool

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



[..]
> >> +       union {
> >> +               /* Next zpdescs in a zspage in zsmalloc zpool */
> >> +               struct zpdesc *next;
> >> +               /* For huge zspage in zsmalloc zpool */
> >> +               unsigned long handle;
> >> +       };
> >> +       struct zspage *zspage;
> >
> > There was a discussion with Yosry on including memcg_data on zpdesc
> > even if it's not used at the moment.
> >
> > Maybe you can look at:
> > https://lore.kernel.org/linux-mm/CAB=+i9Quz9iP2-Lq=oQfKVVnzPDtOaKMm=hUPbnRg5hRxH+qaA@xxxxxxxxxxxxxx/
>
> Thanks for notice.
> The memcg_data isn't used for zpdesc. And I have a bit confusion since Yosry said: "I think to drop memcg_data we need to enlighten the code that ...". So we actually don't need to have this unused member, is this right, Yosry?

I think we need to have it, at least for now. 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.

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.




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux