Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp873506rwb; Wed, 26 Jul 2023 04:27:12 -0700 (PDT) X-Google-Smtp-Source: APBJJlFH/rZB2RoAFRaI0hWimODhqHdI3cFEwsBny9gSZGLzw8Uz1UuBBfDnSenBc7wir4r0CMQV X-Received: by 2002:ac2:4d94:0:b0:4fe:cca:c6f7 with SMTP id g20-20020ac24d94000000b004fe0ccac6f7mr937455lfe.48.1690370832070; Wed, 26 Jul 2023 04:27:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690370832; cv=none; d=google.com; s=arc-20160816; b=sAwYrlK9Fvn/NjJQiTy3oj2jwAdRViah/ZMBz03yKVGU9W4OIIvKfDRiYvqcwCsB+G Wclr9oQJqHIH/qwr1gLVdOGjFONZUVIvG3lxpblk/svxJvWOsO3hRA+edGWPtv+Zc13N dkMe+IwWzFehV3iV20ETOfQ4Dt4yJ3tDL41JUZPwe3/3WOg6mNGHozJVqQOSf9Ki3Cra 0C8R72BYBcoiQGe69foeWUTAD2E/jnKHRj0EJgj+7vXBYVbqeeuYitq8E38mFWj6N5Vs cxBHpEjCe4SRH4rMuL1Mp7mbhw+w9KejUuqNFzasoJUhRZhOdaX18u2OtJJzZbENiQJJ w44g== 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=HGuGAI6NRcEA+8FLamgVp5UecCAp5TEDxE2ZvxOf5nk=; fh=QiK5BPDNw3UXjt9HnLW2F8Go7HSi3D7rqi4oOaai80E=; b=ztdUKGHOI81CxqnxUFbgt80xLRPVwbYn+RcECTVt3Pq6IxUaIW79TNfvGtPCbP2FCp iP8dMtjWzGi0TzswW87bgbLviwhqpLQhZeLAX9QX5YoUimFI7d5HRUzndIf6bVMmSWuW gHvPzev1lE1nJAnHS5YYuG32Jugsd89OyC5Wu6IRzVDgC+pNpqIT9ZB0SZ43dPIJNMls Dx17kdejOV4d7ggKQ/R7nLzWmdx0KkY/ecH+xG+T6zplikMR4rBhEdMK1H6MKYyIlwr3 6Nc4N4jZ6C1P7IKbALpfya9mWZ/0/yb3HNMZaesNqe1k3V00dq0YLQCT76u9A8npB2Z5 9pbg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=bqc4ecmS; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc14-20020a056402204e00b0051a318aa40asi9419068edb.502.2023.07.26.04.26.46; Wed, 26 Jul 2023 04:27:12 -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=@kernel.org header.s=k20201202 header.b=bqc4ecmS; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234015AbjGZKtX (ORCPT + 99 others); Wed, 26 Jul 2023 06:49:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232030AbjGZKtV (ORCPT ); Wed, 26 Jul 2023 06:49:21 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2BC9E0 for ; Wed, 26 Jul 2023 03:49:20 -0700 (PDT) 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 57A9461191 for ; 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-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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, 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.