From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 158C8C0015E for ; Wed, 26 Jul 2023 14:23:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7333C8D0001; Wed, 26 Jul 2023 10:23:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 6E2756B0072; Wed, 26 Jul 2023 10:23:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 5D1A18D0001; Wed, 26 Jul 2023 10:23:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 4C3326B0071 for ; Wed, 26 Jul 2023 10:23:14 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F3B4BB25D9 for ; Wed, 26 Jul 2023 14:23:13 +0000 (UTC) X-FDA: 81053980266.05.6A9E3EC Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.220.28]) by imf03.hostedemail.com (Postfix) with ESMTP id BB8022002E for ; Wed, 26 Jul 2023 14:23:11 +0000 (UTC) Authentication-Results: imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=MsvJtS65; spf=pass (imf03.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690381392; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=pdLmzpg75tnZrRRTpeAi7A3V1bWezalJKRwAcUrA6uQ=; b=ZKriYHSY11KQpaMUbl2MTIk7UJkNZhfNcJpvqyvDv+vGzuyNXsO8/GzugeOWmJpB0dJvLU uWNpiG6dd5AVPL/FOQAHqLysiqehX2KdKn3Uo6kzUTnIRPO/4LM8QFYUtVRviYeEEsHKQA retwDwwZfvzsETOf90d/KAJNW2kFSV8= ARC-Authentication-Results: i=1; imf03.hostedemail.com; dkim=pass header.d=suse.com header.s=susede1 header.b=MsvJtS65; spf=pass (imf03.hostedemail.com: domain of mhocko@suse.com designates 195.135.220.28 as permitted sender) smtp.mailfrom=mhocko@suse.com; dmarc=pass (policy=quarantine) header.from=suse.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690381392; a=rsa-sha256; cv=none; b=IACSgaCtDVq5QlLwTnb7NT2yMas8mpIR7ilpewZv1K/B8KylrJB+q+1lsARNsQOzZ9WXDZ GTOK69s5gJDniuUebm02QiqUKiFpD7WmpBbagWgRMExo6BKg3AVghHtyS6pNRNxs4k9wsr d+g4vrbVL1L1YWkfqST8KVvHucSZGPg= 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-out1.suse.de (Postfix) with ESMTPS id 0E06021B1F; Wed, 26 Jul 2023 14:23:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1690381390; 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=pdLmzpg75tnZrRRTpeAi7A3V1bWezalJKRwAcUrA6uQ=; b=MsvJtS65cV7VVoqAjvfjVGPeB8SqtbxPbwm0gzAqekQXheSBRjk4TfzJ7uri6rUXYzfJGJ IiAXAs+0aZJxJ1mg1Op2j/9fM0iVCPmsXLE+lws91t9O804fpqDOlR+L9pTLAxUQ9Q78Ug 9haQEiP7NO+kKNsU+F/4hRKdcGGhLNI= 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 DE02E1341F; Wed, 26 Jul 2023 14:23:09 +0000 (UTC) Received: from dovecot-director2.suse.de ([192.168.254.65]) by imap2.suse-dmz.suse.de with ESMTPSA id gl0aM00swWQKBwAAMHmgww (envelope-from ); Wed, 26 Jul 2023 14:23:09 +0000 Date: Wed, 26 Jul 2023 16:23:09 +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> <20230726132317.GW1901145@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230726132317.GW1901145@kernel.org> X-Rspamd-Queue-Id: BB8022002E X-Rspam-User: X-Stat-Signature: 4z9gyx7erer93twbz817zyu13q6ifbs4 X-Rspamd-Server: rspam01 X-HE-Tag: 1690381391-317617 X-HE-Meta: U2FsdGVkX18iMHsU4LPOOR5li33b//ADhRHQY+UMjHnaM9Or7n0LhiUNFww1cPBSnzK3dyY3h69BqoGLWRrCysBlTcJEzint02h3Z5Uvs3AsHKJdTigXRe9TcOPja/bdaQeMm+Q4xzE76cAwCwOKiIQrfKvRXm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@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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