Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1012894rwb; Wed, 26 Jul 2023 06:27:01 -0700 (PDT) X-Google-Smtp-Source: APBJJlG9MC7R/5yTK1C6cwIHvqQVc5CBsXV3CtsgY6HD4eenZM00Xi4h+GX8jEUSTCGbL8CTh7Co X-Received: by 2002:a17:906:4ca:b0:94e:4489:f24d with SMTP id g10-20020a17090604ca00b0094e4489f24dmr1760987eja.61.1690378020704; Wed, 26 Jul 2023 06:27:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690378020; cv=none; d=google.com; s=arc-20160816; b=GpaVcvtzOGFsFeRShNwCAu8T9xqZecCryy9DGBMogQ7e/FKmUHKZbg0QfGLX69mN3D X0ms7mnQyNnMPKqRDtdMkHmNe3R6ArsRRO7Xv8XRuRh93/GLGXWEb9krK6DSgYuv3kK+ gfqkXjW/QfBmot4KbOLZW58zogRw+dtVWnfs1BAN4ETVP1at6XV7zoWSuKFE9Z29stNX NxhRDEXktP/B1mR83d4LWD7W7XkFFRH1tm6VvTmEg6Q89rHyMwQ4PaccRoNwLOu7EJUn GQynVENBKvDsz626L9B8v5t0jqMoRzmb9+k5Jx1fVcO7yoLA9xXNIes7p4fUdH4VSDA2 Cp1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=JsVlVxE/XD0oPiX1UvfnaXUZ36FHRqz8iuVNvRWinBA=; fh=UJLdpx8n7Gl9FEJb1hC0LwjqjR3dtI89K7ZWYOyozJ8=; b=oSZ2aJqwhiFBfWta1Mo0l6q149dfA1J1F6umu/gR8o5bcj3MZi+LczumECKrmtxrbq 4yJfHgqGMsYaoBaMOteGAxuDGdzektSKJfpg1k/AKwH8vKvh68XBtg3ujXhWz+0fDtI9 MEXeDEEWLvjL1cqcTXibljF5gXuePzyU80lJvOWeLEFD0lKpnZr7EyGwAvu8Dg/s+Iwx zUBtl6g+iytUYs8NC8SGQQueso07o2F09mCja0uud81Dv2OwhVZ57f3HBO0K4CkrXb9Z u23RK+Fq14noCvyUpDFDniJ35pxJrCYtfH2eRADukokNo/NQMqAz2POvHNhaAN9uzdpq 9jJg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TBc6pOsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ks27-20020a170906f85b00b00992e90ca00dsi9542063ejb.16.2023.07.26.06.26.35; Wed, 26 Jul 2023 06:27:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=susede1 header.b=TBc6pOsG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229715AbjGZM6E (ORCPT + 99 others); Wed, 26 Jul 2023 08:58:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233231AbjGZM56 (ORCPT ); Wed, 26 Jul 2023 08:57:58 -0400 Received: from smtp-out2.suse.de (smtp-out2.suse.de [195.135.220.29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 63CF21BD1 for ; Wed, 26 Jul 2023 05:57:57 -0700 (PDT) Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 221BF1F85D; Wed, 26 Jul 2023 12:57:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690376276; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=JsVlVxE/XD0oPiX1UvfnaXUZ36FHRqz8iuVNvRWinBA=; b=TBc6pOsGliW7gRiLBeZUck45Tz53nDINg984kXv13Gba0FsMhY10tnwm2UvbitRcP1LosM D/RL0ELL8S78v0eX5s2pyl4ctI+kbED1LYhESC780ZC8ngUBUVHC/LIrB2Dwcn9XYTAbVy jJ9QPv7x/f4B4XgLIOj8sj1afgWQ0zw= Received: from imap2.suse-dmz.suse.de (imap2.suse-dmz.suse.de [192.168.254.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-521) server-digest SHA512) (No client certificate requested) by imap2.suse-dmz.suse.de (Postfix) with ESMTPS id F2E73139BD; Wed, 26 Jul 2023 12:57:55 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id v6oEOFMYwWR5VgAAMHmgww (envelope-from ); Wed, 26 Jul 2023 12:57:55 +0000 Date: Wed, 26 Jul 2023 14:57:55 +0200 From: Michal Hocko To: Mike Rapoport Cc: Ross Zwisler , linux-kernel@vger.kernel.org, linux-mm@kvack.org, Andrew Morton , Matthew Wilcox , Mel Gorman , Vlastimil Babka , David Hildenbrand Subject: Re: collision between ZONE_MOVABLE and memblock allocations Message-ID: References: <20230718220106.GA3117638@google.com> <20230719054434.GG1901145@kernel.org> <20230719222604.GB3528218@google.com> <20230721112009.GP1901145@kernel.org> <20230726104845.GS1901145@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230726104845.GS1901145@kernel.org> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. -- Michal Hocko SUSE Labs