linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@suse.com>
To: Mike Rapoport <rppt@kernel.org>
Cc: Ross Zwisler <zwisler@google.com>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Andrew Morton <akpm@linux-foundation.org>,
	Matthew Wilcox <willy@infradead.org>,
	Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>,
	David Hildenbrand <david@redhat.com>
Subject: Re: collision between ZONE_MOVABLE and memblock allocations
Date: Wed, 26 Jul 2023 16:23:09 +0200	[thread overview]
Message-ID: <ZMEsTca+3KcA3I7/@dhcp22.suse.cz> (raw)
In-Reply-To: <20230726132317.GW1901145@kernel.org>

On Wed 26-07-23 16:23:17, Mike Rapoport wrote:
> 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.

Higher memory is usually not a problem AFAIK. It is lowmem that is a
more scarce resource because some HW might be constrained in why phys
address range is visible.

-- 
Michal Hocko
SUSE Labs


  reply	other threads:[~2023-07-26 14:23 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-18 22:01 Ross Zwisler
2023-07-19  5:44 ` Mike Rapoport
2023-07-19 22:26   ` Ross Zwisler
2023-07-21 11:20     ` Mike Rapoport
2023-07-26  7:49       ` Michal Hocko
2023-07-26 10:48         ` Mike Rapoport
2023-07-26 12:57           ` Michal Hocko
2023-07-26 13:23             ` Mike Rapoport
2023-07-26 14:23               ` Michal Hocko [this message]
2023-07-19  6:14 ` Michal Hocko
2023-07-19  7:59   ` Mike Rapoport
2023-07-19  8:06     ` Michal Hocko
2023-07-19  8:14       ` David Hildenbrand
2023-07-19 23:05         ` Ross Zwisler
2023-07-26  8:31           ` David Hildenbrand
2023-07-19 22:48   ` Ross Zwisler
2023-07-20  7:49     ` Michal Hocko
2023-07-20 12:13     ` Michal Hocko
2023-07-24 16:56       ` Ross Zwisler
2023-07-26  8:44     ` David Hildenbrand
2023-07-26 13:08       ` David Hildenbrand
2023-07-27  8:18       ` Michal Hocko
2023-07-27  9:41         ` David Hildenbrand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZMEsTca+3KcA3I7/@dhcp22.suse.cz \
    --to=mhocko@suse.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=rppt@kernel.org \
    --cc=vbabka@suse.cz \
    --cc=willy@infradead.org \
    --cc=zwisler@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox