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 2129CC0015E for ; Wed, 26 Jul 2023 10:49:24 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A17AA6B0071; Wed, 26 Jul 2023 06:49:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9A1028D0001; Wed, 26 Jul 2023 06:49:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 868416B007B; Wed, 26 Jul 2023 06:49:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 724616B0071 for ; Wed, 26 Jul 2023 06:49:23 -0400 (EDT) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 350941A016C for ; Wed, 26 Jul 2023 10:49:23 +0000 (UTC) X-FDA: 81053441406.04.83B2255 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf28.hostedemail.com (Postfix) with ESMTP id 56E74C0008 for ; Wed, 26 Jul 2023 10:49:21 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bqc4ecmS; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690368561; 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=HGuGAI6NRcEA+8FLamgVp5UecCAp5TEDxE2ZvxOf5nk=; b=wa0xud88i9WILVNeHDFL1MwMXPukpn9aqk9XPYXr9BInUXWQqV+N/PSBrfM+B6yM+jF02u OttJyK+JBwM3MOVGUNSLVmdwo7t8aAihE9cNcXeiOvywlTAbYrriAf9tgQIAHolcSm+eqS Kpo3/kW3y4D9Q575fdWaGG5En7D2c4Q= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b=bqc4ecmS; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf28.hostedemail.com: domain of rppt@kernel.org designates 139.178.84.217 as permitted sender) smtp.mailfrom=rppt@kernel.org ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690368561; a=rsa-sha256; cv=none; b=XQlOQLxTEeLZsRFG28u60Q63cPY/pVinsLr3cnk3aHxjyffnfopMnshLFNOGBPnA8/0vR5 VZrTdnPlJdnuQbjhfrRClssfX2Bf8k9D5v5yvX0sn9hIU+Enaovxx9LVpu+gpIQZpe+76S Laaxp8VxEiIcLCR9XjM30Qk4QbTuB0s= Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 5A76961A1E; Wed, 26 Jul 2023 10:49:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 71BBCC433C7; Wed, 26 Jul 2023 10:49:16 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690368559; bh=XW9jeWYC069dD2SquyS3d83hGNshFguuHhd0e7UK8EA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=bqc4ecmS18ZUUKwn7AklD8a+LiC+5ojGmhDL/pGLV99cWiEwuXt8ij9X1eujJHgYo FlEXFXNe5kaMtGq0IxkLzdd+2ye8F6t/dygb8ajt6rgriKkCxHF+5UguQ3+hauNMcU 59eLA45Uafo+6qasWX2M2TtdA7iZXF6y84d6Njg/xsf1un5J9zpMVg/sgVJqLmcM+H bR5e4YGCXn5JD6NKlohnS81OfawnIgslbOFWiM64iL24xf659G22Plnxxs7ztLOSfo rMHCRoAW/FQjohJS7cgRoVq1T5gaD4uaHVH8lsQ1I3QwHV7qxT7dxXUML+vMm1bqdJ DXTAt5slxilWg== Date: Wed, 26 Jul 2023 13:48:45 +0300 From: Mike Rapoport To: Michal Hocko 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: <20230726104845.GS1901145@kernel.org> References: <20230718220106.GA3117638@google.com> <20230719054434.GG1901145@kernel.org> <20230719222604.GB3528218@google.com> <20230721112009.GP1901145@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 56E74C0008 X-Stat-Signature: pbeayc73a4pwwfp8d59kr5i5iwxfh5s4 X-Rspam-User: X-HE-Tag: 1690368561-301519 X-HE-Meta: U2FsdGVkX18LUr34D0R9LWIjsLLW5eecYvzfu7vC1Ww4hWBvYYb5hAH6rR3w7iwpMPQtBBFDHpJTrnJx1L5kCRdcFnjsfptvDuVlMYMeZm5+koKcJ34zmX8dDJIehUzI8wcHNsWS2sYATps6ihmgvI9GipNAEFXE+uwrhCUgtNqFgfuqIRZelAy0nyYlbXXUEdEY78eyraR/Tg0wfL8Dp6rJIBAbW68tw34nHeoSjocoB2c0phi7mysQM7r68etCZqz2dpAYpHdNQlkzpOkw7Zw5FH/rDfwwqUfr/KFCyE7V2ap/XnGXH/7SjVOKPkLBGSbtPnQcQALJBt8J4QCQ9bZN3qm+txYI9ScEbw4kXpUVZ8s1wJ+XKjwI3fn64ydeV6bnEHRAXkINzFJLQ0FUMzmDkzZiDTpd59RBlqJO/64iRJCwAeo+jXcarfFonR7rHhdnyd/2uMoyxZQArGKQL4NDartjgVTN9bBA/D/1lkiIRsu8dffWpoRClD81exIbEyMUjATi2AT2is/7xYYgwjF6OR9Ae5S6pW2nSp0KJTj3Itpqo2ygaxl/kDIC0dMLm/dJEsUiDsEdBnweheXaQ0Ks013XjBfRiBE9Bo/d20RyF11Sg9yjxidAEi5dB48GsJxRvdHxb9Bat8L2mBa8Okp4gdX8AMdCszMUSziASz6g2WDqYJptLtoHpAVJaZ01XzZoZoHeBpcsOt57RX3D0TxQ9Glcow5AMlhmT9aLkM2j+Otpn3A58hZKN5xdCbVjajr/RZtgbsSiDq7F/ua7iOjefKkXggTFWUzC5U+7/XmASz2IbKZh8sxd/nxKtwaZp5YOf1jcNgvp/1LV8zluHXhe84+WpOI7Nfzg1Zq1KTlUAze9xDFQEvL4RniUGx8xLMNPqWAOYkzC9h7enwKUXUMz9hpeWAZaD/l0qpg4tb4kRApJ3Fn0wOAHxhOmZNWUBLbHpH468DXPQJ2bZlG onVT4MeU Qmsg+Tc5O8Moqu4gl1M28CBvGYM8Wecrs9IcjTYW418mH3iTnwEA2rMZY/Qw3oT0smBwvkr12JvHuQgII+snlWxAe9ZTuJGehc2E9eq2VJtFWmFU8363A5m5E+A2i0RJDchjSKIMwCYhhBcq/nGFv/Qicfyyqi0FjuNUIRBgAvHbfghqpTrdA4xzzUFmOB58bRtEnMlvD2c3mbnkTBvhuXGdpBmO0NVB5k0+lZLuMGWZetACVub5neJU1VNvoJPpvJ46UWchreKq8IH+/VPvyAI0neOjtdbvQPpq8u734Aa8iDETAITUjDmR6n/Ru8qAnMYBlp75KNa6L3Qq8sqLyb9dqkA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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"? Using a limit for allocations and then falling back to the entire available memory if allocation fails within the limits? > -- > Michal Hocko > SUSE Labs -- Sincerely yours, Mike.