From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Subject: Re: [PATCH v2 00/33] Separate struct slab from struct page Date: Mon, 20 Dec 2021 01:42:13 +0000 Message-ID: References: <20211201181510.18784-1-vbabka@suse.cz> <4c3dfdfa-2e19-a9a7-7945-3d75bc87ca05@suse.cz> <86617be0-8aa8-67d2-08bd-1e06c3d12785@suse.cz> Mime-Version: 1.0 Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=casper.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=k7fHWgKrjS6NSIvn5a4Jtgxmp/WhT9Wz1heA+PvFHEU=; b=fbUn3fvK/C4lIcfXkF1dhfDZp+ 0ZelBeFgnQYcFnt0EOTirvxdbva/ddh2SL+FntgltRD3RE987l95C52xyYhhRfbE2xb17KwOfKlFs 5hOrS2+3DKFsP3AzTTFXGdtnAfDlAGiCbxuyVX733jeZZ+d0DD58EAaIyKmbheLpfRjDtShOeT6am hg7mxrzy3tJ/5EM0XQThsZ+qE0Zv7Dl2ydMZ44Ueicge/g2XjDjlE+5Q0yijLnkgOFaSa51eA1ivu 3KHkjCK1aKheaU9DVEJ4MCzqGgtQ+Ndgh2oKwtYQK2wpphRgppBrz+kxZNRgm1Zd6KP6yXdmRMLqn IlqHXmWA==; Content-Disposition: inline In-Reply-To: <86617be0-8aa8-67d2-08bd-1e06c3d12785-AlSwsSmVLrQ@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Vlastimil Babka Cc: Roman Gushchin , Christoph Lameter , David Rientjes , Joonsoo Kim , Pekka Enberg , linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, Andrew Morton , patches-cunTk1MwBs/YUNznpcFYbw@public.gmane.org, Alexander Potapenko , Andrey Konovalov , Andrey Ryabinin , Andy Lutomirski , Borislav Petkov , cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Dave Hansen , David Woodhouse , Dmitry Vyukov , "H. Peter Anvin" , Ingo Molnar , iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, Joerg Roedel , Johannes Weiner , J On Mon, Dec 20, 2021 at 01:47:54AM +0100, Vlastimil Babka wrote: > > * mm/slub: Convert print_page_info() to print_slab_info() > > Do we really need to explicitly convert slab_folio()'s result to (struct folio *)? > > Unfortunately yes, as long as folio_flags() don't take const struct folio *, > which will need some yak shaving. In case anyone's interested ... folio_flags calls VM_BUG_ON_PGFLAGS() which would need its second argument to be const. That means dump_page() needs to take a const struct page, which means __dump_page() needs its argument to be const. That calls ... is_migrate_cma_page() page_mapping() page_mapcount() page_ref_count() page_to_pgoff() page_to_pfn() hpage_pincount_available() head_compound_mapcount() head_compound_pincount() compound_order() PageKsm() PageAnon() PageCompound() ... and at that point, I ran out of motivation to track down some parts of this tarbaby that could be fixed. I did do: mm: constify page_count and page_ref_count mm: constify get_pfnblock_flags_mask and get_pfnblock_migratetype mm: make compound_head const-preserving mm/page_owner: constify dump_page_owner so some of those are already done. But a lot of them just need to be done at the same time. For example, page_mapping() calls folio_mapping() which calls folio_test_slab() which calls folio_flags(), so dump_page() and page_mapping() need to be done at the same time. One bit that could be broken off easily (I think ...) is PageTransTail() PageTail(), PageCompound(), PageHuge(), page_to_pgoff() and page_to_index(). One wrinkle is needed a temporary TESTPAGEFLAGS_FALSE_CONST. But I haven't tried it yet.