Re: [PATCH RFC 05/12] mm/slab: abstract slabobj_ext.objcg access
Ye Liu <[email protected]>
| Newsgroups | org.kernel.vger.cgroups,org.kernel.vger.linux-kernel,org.kvack.linux-mm |
|---|---|
| Message-ID | <[email protected]> |
在 2026/7/21 03:58, Omar Sandoval 写道: > On Fri, Jul 17, 2026 at 12:00:29PM +0200, Vlastimil Babka (SUSE) wrote: >> On 7/15/26 12:10, Vlastimil Babka (SUSE) wrote: >>> In preparation for changes to the structure, abstract access to the >>> objcg field with a slab_obj_ext_objcgp() function. >>> Rename the field to _objcg to make an unexpected direct access a compile >>> error. >>> >>> No functional change intended. >>> >>> Signed-off-by: Vlastimil Babka (SUSE) <[email protected]> >> Hm sashiko finds [1] that this is breaks tools/mm/show_page_info.py >> >> But I think it was already buggy. get_memcg_info() is supposed to return >> memcg info for a page but in case of MEMCG_DATA_OBJEXTS there's no such info >> for the whole page, there is only for individual slab objects and it doesn't >> know which object so it effectively gets the first one. I think it should >> just stop handling MEMCG_DATA_OBJEXTS, but that's a fix that should be sent >> unrelated to this series. >> >> There's also tools/cgroup/memcg_slabinfo.py and that I think has been >> already broken with memalloc profiling as it assuems slab.memcg_data is >> still a raw struct obj_cgroup * and not struct slabobj_ext. >> >> I think it will be easier to fix it at once to handle the layout after this >> series than trying to fix it first to handle the pre-series layout and then >> update it with every relevant change. >> >> [1] >> https://sashiko.dev/#/patchset/[email protected]?part=5 > FWIW, if these scripts were in the drgn repo with test cases, these > breakages would be caught by our CI and someone (usually me) would fix > them up promptly :) When I first used the drgn tool, I noticed that some scripts were directly merged into the kernel repository, so I merged show_page_info.py into the kernel repository as well. Later, I found that merging into the drgn repository was also a good option, so I merged it into the drgn repository as well, and maintain it there. Therefore, I currently use show_page_info.py regularly and update it promptly if I find any issues. -- Thanks, Ye Liu