The Linux Kernel Mailing List
 help / color / mirror / Atom feed
  • [parent not found: <20260320-page_alloc-unmapped-v2-9-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-11-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-12-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-13-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-10-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-14-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-15-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-16-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-18-28bf1bd54f41@google.com>]
  • [parent not found: <20260320-page_alloc-unmapped-v2-19-28bf1bd54f41@google.com>]
  • * Re: [PATCH v2 00/22] mm: Add __GFP_UNMAPPED
           [not found] <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com>
                       ` (10 preceding siblings ...)
           [not found] ` <20260320-page_alloc-unmapped-v2-19-28bf1bd54f41@google.com>
    @ 2026-05-13 16:17 ` Gregory Price
      2026-05-13 17:14   ` Brendan Jackman
           [not found] ` <20260320-page_alloc-unmapped-v2-20-28bf1bd54f41@google.com>
      12 siblings, 1 reply; 24+ messages in thread
    From: Gregory Price @ 2026-05-13 16:17 UTC (permalink / raw)
      To: Brendan Jackman
      Cc: Borislav Petkov, Dave Hansen, Peter Zijlstra, Andrew Morton,
    	David Hildenbrand, Vlastimil Babka, Wei Xu, Johannes Weiner,
    	Zi Yan, Lorenzo Stoakes, linux-mm, linux-kernel, x86, rppt,
    	Sumit Garg, derkling, reijiw, Will Deacon, rientjes,
    	Kalyazin, Nikita, patrick.roy, Itazuri, Takahiro, Andy Lutomirski,
    	David Kaplan, Thomas Gleixner, Yosry Ahmed
    
    On Fri, Mar 20, 2026 at 06:23:24PM +0000, Brendan Jackman wrote:
    > 
    > Because of these ambitious usecases, it's core to this proposal that the
    > feature
    > overloading the concept of a migratetype, this extension is done by
    > adding a new concept on top of migratetype: the _freetype_. A freetype
    > is basically just a migratetype plus some flags, and it replaces
    > migratetypes wherever the latter is currently used as to index free
    > pages.
    >
    
    I'm a bit confused why the need for additional level of indirection
    instead of just adding a new migratetype.  You still end up increasing
    the migratetype matrix, just with a new dimension.
    
    (apologies if this was covered in prior work or discussions, just now
     plugging myself into the series).
    
    Why not simply have an unmapped migratetype, for example, and on steal
    you convert it to movable or whatever the preference is? 
    
    > .:::: Hacky bits: simplistic secretmem integration
    > 
    > The secretmem integration leaves the mmain optimisations on the table;
    > the security-required flushes of the mermap areas are implemented via
    > distinct tlb_flush_mm() calls. It should be possible to amortize the
    > mermap TLB flushes completely into the normal VMA flushing. However, as
    > far as I know there is no performance-sensitive usecase for secretmem.
    > So, I've just implemented the minimal adoption. This will at least avoid
    > fragmentation of the direct map, even if it doesn't reduce TLB flushing.
    > If anyone knows of a workload that might benefit from dropping that
    > flushing, let me know!
    
    Crossing a couple streams here, I wonder if there's some mechanisms
    introduced by MST's latest multi-zeroing-avoidance [1] code that might
    help deal with the problem here.
    
    MST wired up an optional user_addr into the buddy that allows us to sink
    the zeroing step for folio_zero_user (or folio_user_zero or whatever)
    into the post_alloc_hook - which includes some cache flushing.
    
    That conveniently gives you what you need for a TLB flush AND an
    indicator that the allocation is intended for userland.
    
    Unless I'm fundamentally misunderstanding something, the pattern at least
    seems similar.
    
    In that sense, does this just become a post_alloc_hook that unmaps the
    memory after zeroing and allocation?
    
    I get the intent is to have the majority of memory unmapped by default,
    and then steal those blocks and map them as the kernel requires more
    memory, but I wonder if it's cleaner to do it the other way and simply
    have the buddy unmap on alloc after zeroing, and remap on free.
    
    Seems like the free path would be trivial, check if the page is in the
    direct map and if not, remap it and move on.  Entirely hidden from
    existing users.
    
    So, maybe a stupid question:  Was the opposite mechanism considered
    (unmap on alloc sunk into the buddy), and if so was it rejected for some
    other reason?
    
    [1] https://lore.kernel.org/linux-mm/cover.1778616612.git.mst@redhat.com/
    
    ~Gregory
    
    ^ permalink raw reply	[flat|nested] 24+ messages in thread
  • [parent not found: <20260320-page_alloc-unmapped-v2-20-28bf1bd54f41@google.com>]

  • end of thread, other threads:[~2026-05-13 17:59 UTC | newest]
    
    Thread overview: 24+ messages (download: mbox.gz follow: Atom feed
    -- links below jump to the message on this page --
         [not found] <20260320-page_alloc-unmapped-v2-0-28bf1bd54f41@google.com>
         [not found] ` <20260320-page_alloc-unmapped-v2-8-28bf1bd54f41@google.com>
    2026-05-11 13:46   ` [PATCH v2 08/22] mm: introduce for_each_free_list() Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-9-28bf1bd54f41@google.com>
    2026-05-11 13:51   ` [PATCH v2 09/22] mm/page_alloc: don't overload migratetype in find_suitable_fallback() Vlastimil Babka (SUSE)
    2026-05-11 16:44     ` Brendan Jackman
    2026-05-11 16:53       ` Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-11-28bf1bd54f41@google.com>
    2026-05-11 15:35   ` [PATCH v2 11/22] mm: move migratetype definitions to freetype.h Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-12-28bf1bd54f41@google.com>
    2026-05-11 18:01   ` [PATCH v2 12/22] mm: add definitions for allocating unmapped pages Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-13-28bf1bd54f41@google.com>
    2026-05-11 18:07   ` [PATCH v2 13/22] mm: rejig pageblock mask definitions Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-10-28bf1bd54f41@google.com>
    2026-05-11 15:34   ` [PATCH v2 10/22] mm: introduce freetype_t Vlastimil Babka (SUSE)
    2026-05-11 16:49     ` Brendan Jackman
    2026-05-11 16:58       ` Vlastimil Babka (SUSE)
    2026-05-11 18:17   ` Vlastimil Babka (SUSE)
    2026-05-11 18:26   ` Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-14-28bf1bd54f41@google.com>
    2026-05-11 18:29   ` [PATCH v2 14/22] mm: encode freetype flags in pageblock flags Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-15-28bf1bd54f41@google.com>
    2026-05-11 18:30   ` [PATCH v2 15/22] mm/page_alloc: remove ifdefs from pindex helpers Vlastimil Babka (SUSE)
    2026-05-12  9:49     ` Brendan Jackman
         [not found] ` <20260320-page_alloc-unmapped-v2-16-28bf1bd54f41@google.com>
    2026-05-13  8:46   ` [PATCH v2 16/22] mm/page_alloc: separate pcplists by freetype flags Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-18-28bf1bd54f41@google.com>
    2026-05-13  9:43   ` [PATCH v2 18/22] mm/page_alloc: introduce ALLOC_NOBLOCK Vlastimil Babka (SUSE)
         [not found] ` <20260320-page_alloc-unmapped-v2-19-28bf1bd54f41@google.com>
    2026-05-13 15:43   ` [PATCH v2 19/22] mm/page_alloc: implement __GFP_UNMAPPED allocations Vlastimil Babka (SUSE)
    2026-05-13 16:17 ` [PATCH v2 00/22] mm: Add __GFP_UNMAPPED Gregory Price
    2026-05-13 17:14   ` Brendan Jackman
    2026-05-13 17:28     ` Gregory Price
    2026-05-13 17:38       ` Vlastimil Babka (SUSE)
    2026-05-13 17:59         ` Gregory Price
         [not found] ` <20260320-page_alloc-unmapped-v2-20-28bf1bd54f41@google.com>
    2026-05-13 17:00   ` [PATCH v2 20/22] mm/page_alloc: implement __GFP_UNMAPPED|__GFP_ZERO allocations Vlastimil Babka (SUSE)
    

    This is a public inbox, see mirroring instructions
    for how to clone and mirror all data and code used for this inbox