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 D9031C001B0 for ; Wed, 26 Jul 2023 13:23:57 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 507786B0071; Wed, 26 Jul 2023 09:23:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4B8096B0072; Wed, 26 Jul 2023 09:23:57 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3A6796B0074; Wed, 26 Jul 2023 09:23:57 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2B1476B0071 for ; Wed, 26 Jul 2023 09:23:57 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id EDEB340D87 for ; Wed, 26 Jul 2023 13:23:56 +0000 (UTC) X-FDA: 81053830872.22.AF50E17 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by imf29.hostedemail.com (Postfix) with ESMTP id 34DD012000E for ; Wed, 26 Jul 2023 13:23:54 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="F/9e740J"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.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=1690377835; 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=ZcP9e4Tvss4xlGPSLU6K5LVfX/gOA1cF+/SzFyWp4rs=; b=3gV1fgyf76Pr3TAvWRxw3rigJ3a+7zWkaQ05uYWVMGQKZlVm6Ob1eGPOUShQ0/ismmiIRT AvVDXRtsKJsGeKcMXHZE1z+vCO4Ozd6C6WofkabHx8TJDqge7/yhZ19orS0OcXwlMYCkNG MR2onaLRzrkZQNB/RD+Jukv6CyPXpKg= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=pass header.d=kernel.org header.s=k20201202 header.b="F/9e740J"; dmarc=pass (policy=none) header.from=kernel.org; spf=pass (imf29.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=1690377835; a=rsa-sha256; cv=none; b=HDAzprKofUZXzKcrwJjtTBxNrSmlIQ+ixTZIeXFb5JuEODRkeU4muB4OZjtG3g9yft2CFk XdJMmHxivHu4PJWgYZcYwXDMxnX8irHbT8g+1i/kEEgFybDF9/hUlOM60oWzj4myrbiFwK 1YR3PNhpSEoyfgQrbtF0XPsUSEqz6ho= 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 2DBDB617A5; Wed, 26 Jul 2023 13:23:54 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 58562C433C8; Wed, 26 Jul 2023 13:23:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690377833; bh=RMJHNPuU7N+ifmLTxkLjkm+2qqsjVUIwz7cKJtDoWbM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=F/9e740JSt/fg+KTnjEJpsCcx4fWypXGT4Lr0x/lLPs12tVTqPVVtts97My4841L2 /y+6z/mj00yqiKQzILkiDXsS2N2zxbWHEvy8NSSm184Y+cNuGwwEAGq1GiZBanFuy1 Q7dkOwekJ13EVtH8hyPKeIH774ljmz6wBLSASLTYFCEUCyd/dH4q/DlLIlJRLEJYKp +PPNAMUTQcWOBXkpsE6x7Vtsx6Cj0tKmuo4yZ7po/JLR1ysZ0NCM8FCsGplIiyLGLl HLQDWxufS86yv1rLUUX0R9/gJ7fofNiJRxdT3V2R/7wV30kr/LAi8QiaPDCgc5u51G yoWqAIkRwoTUg== Date: Wed, 26 Jul 2023 16:23:17 +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: <20230726132317.GW1901145@kernel.org> 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: X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 34DD012000E X-Stat-Signature: pr4n4i5qdax3h5sd8m457m19s7shbbs8 X-HE-Tag: 1690377834-602012 X-HE-Meta: U2FsdGVkX18p12L7WgfRlibn0dxChsjIbcKQUbFiV7F3Rr2hBo2q/zcvwqCV8FXPQ0U1jfZ79C3rkl6CVSVasRhFSDsuKfhYYEBcuDHyuYS3MUEnqGEyviTHfxp7ErYcOsKExUmsPDUO/M0914Q8X+43c5tokAhQhgG2SoFyU8dyWT5ZlVUJHpInuIE+mRwO/WbWTJGZntTQiZDwclKOuJL9uRb+8/3teTuhBD+AIa/Y/5c/i3qkOaynwfVybT73dSzO4+WI/F8N/zewz+ifxO6Ng+CX99UQGiOdGMtZeqR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4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.