[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230726132317.GW1901145@kernel.org>
Date: Wed, 26 Jul 2023 16:23:17 +0300
From: Mike Rapoport <rppt@...nel.org>
To: Michal Hocko <mhocko@...e.com>
Cc: Ross Zwisler <zwisler@...gle.com>, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, Andrew Morton <akpm@...ux-foundation.org>,
Matthew Wilcox <willy@...radead.org>,
Mel Gorman <mgorman@...e.de>, Vlastimil Babka <vbabka@...e.cz>,
David Hildenbrand <david@...hat.com>
Subject: Re: collision between ZONE_MOVABLE and memblock allocations
On Wed, Jul 26, 2023 at 02:57:55PM +0200, Michal Hocko wrote:
> On Wed 26-07-23 13:48:45, Mike Rapoport wrote:
> > On Wed, Jul 26, 2023 at 09:49:12AM +0200, Michal Hocko wrote:
> > > On Fri 21-07-23 14:20:09, Mike Rapoport wrote:
> > > > On Wed, Jul 19, 2023 at 04:26:04PM -0600, Ross Zwisler wrote:
> > > > > On Wed, Jul 19, 2023 at 08:44:34AM +0300, Mike Rapoport wrote:
> > > > > > 3. Switch memblock to use bottom up allocations. Historically memblock
> > > > > > allocated memory from the top to avoid corrupting the kernel image and to
> > > > > > avoid exhausting precious ZONE_DMA. I believe we can use bottom-up
> > > > > > allocations with lower limit of memblock allocations set to 16M.
> > > > > >
> > > > > > With the hack below no memblock allocations will end up in ZONE_MOVABLE:
> > > > >
> > > > > Yep, I've confirmed that for my use cases at least this does the trick, thank
> > > > > you! I had thought about moving the memblock allocations, but had no idea it
> > > > > was (basically) already supported and thought it'd be much riskier than just
> > > > > adjusting where ZONE_MOVABLE lived.
> > > > >
> > > > > Is there a reason for this to not be a real option for users, maybe per a
> > > > > kernel config knob or something? I'm happy to explore other options in this
> > > > > thread, but this is doing the trick so far.
> > > >
> > > > I think we can make x86 always use bottom up.
> > > >
> > > > To do this properly we'd need to set lower limit for memblock allocations
> > > > to MAX_DMA32_PFN and allow fallback below it so that early allocations
> > > > won't eat memory from ZONE_DMA32.
> > > >
> > > > Aside from x86 boot being fragile in general I don't see why this wouldn't
> > > > work.
> > >
> > > This would add a very subtle depency of a functionality on the specific
> > > boot allocator behavior and that is bad for long term maintenance.
> >
> > What do you mean by "specific boot allocator behavior"?
>
> I mean that the expectation that the boot allocator starts from low
> addresses and functionality depending on that is too fragile. This has
> already caused some problems in the past IIRC.
Well, any change in x86 boot sequence may cause all sorts of problems :)
We do some of the boot time allocations from low addresses when
movable_node is enabled and that is entirely implicit and buried deep
inside the code.
What I'm suggesting is to switch the allocations to bottom-up once and for
all with explicitly set lower limit and a defined semantics for a fallback.
This might cause some bumps in the beginning, but I don't expect it to be a
maintenance problem in the long run.
And it will free higher memory from early allocations for all usecases, not
just this one.
> --
> Michal Hocko
> SUSE Labs
--
Sincerely yours,
Mike.
Powered by blists - more mailing lists