Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp1498454rwb; Wed, 26 Jul 2023 13:32:07 -0700 (PDT) X-Google-Smtp-Source: APBJJlGdpmy7JEVW3TatdNW43cSE/oIS2I289WRDVsEI0oH+K3WdZz0FVDyMki4CKmFkQxi5V3Ux X-Received: by 2002:a05:6a00:10c4:b0:67b:f249:35e2 with SMTP id d4-20020a056a0010c400b0067bf24935e2mr4035258pfu.21.1690403527661; Wed, 26 Jul 2023 13:32:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690403527; cv=none; d=google.com; s=arc-20160816; b=fVCvbFMq6YfAd1bsQ2lqFWLNotFZlwYBHnBodQF6v1Y9Gc+Sg6Ehj4S4c+8ynTchBx itRZgnCc4BShFymgxCISmaAuNX2g/WiwcFLOjTpulzVGkddYl+ea84Xq3/aFMRgzb+M+ zssJlSswLrEN/mlUAPZRcPEBCx+Ty9Z3aOd3totIQ211Fnrnr3mEML4Cu42sR2wxH3cS RGIDIokZayMqujmrjkP+TX2ER6tYhgVn8ZRNdGVZlV4cX4iIIOvnTwGo5R+BxKLnJ6/O 0XJ9ZFy2UdO4gSgG2dMdH5v3hKAvbWM3O/L3CFnIGcovQ9+pPTgTh3X+k06AloT3ySjU fOSA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=Fpzjs7Jgze9McVogfa/4+ch0fp7gUj2dDPLtv0459+M=; fh=FPKwtOw5uPYYCJV6Pmv8aDTgNke4UahqmdouaysNX30=; b=TVoeRIXPBf1YHkDMgHuSZXYjGQL1tNOumPB9e9LFuaF3SNKJplkAGAYl96CiNTySpl hx52eJcljfjsanMeTniRFydqdkKvceslqcs50c290o4WSvyVqMKIvbLJPhOOZrdYY1bX pGBbXuUqEaVVKtF4xS6q+T5xLsbTWDUEK7iRnx++BxV3bJg+9L66JqXQNQsiaeoyclT1 HGkDjO4ufx+5uWcLDtwiqkwmzswaLw/Hxuu0liLH+mCTayAbQiYncw4EOUEMvb9i5bYi BZ+RKm2nRYDiNWUxESKwjxs2+1d02Lrl55w9IG4qn14QvVID2ifo5nqCLSzHJWDuJ+/m uGLg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=2IXrfCmJ; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q24-20020a637518000000b00553851380besi13731949pgc.397.2023.07.26.13.31.54; Wed, 26 Jul 2023 13:32:07 -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=@linux-foundation.org header.s=korg header.b=2IXrfCmJ; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229963AbjGZUGZ (ORCPT + 99 others); Wed, 26 Jul 2023 16:06:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229595AbjGZUGY (ORCPT ); Wed, 26 Jul 2023 16:06:24 -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 2339A1FCF for ; Wed, 26 Jul 2023 13:06:23 -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 A9EFD61CAD for ; Wed, 26 Jul 2023 20:06:22 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B5203C433C8; Wed, 26 Jul 2023 20:06:21 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1690401982; bh=AZeY2z2NgjtDYunEIr50xtoXJGuiXouk66tb+dsJ1MI=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=2IXrfCmJqtltWZGEj/Lku8/N3y+UngB1KKljhSCAnveW/mCwPRDhYaGnKkxap07lq /tVOUwWYwVEaxczH37wPjqTlIO0YJm1hjkSyqGRrmPgwzMnbes1A50U/J/N0H4HY0B 0MpwG6XlHXzCBaq2H3pBgB8lT9ik2s0Y3rxFi/I8= Date: Wed, 26 Jul 2023 13:06:20 -0700 From: Andrew Morton To: Johannes Weiner Cc: Vlastimil Babka , Mel Gorman , Roman Gushchin , Rik van Riel , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, Zhaoyang Huang Subject: Re: [PATCH v2] mm: page_alloc: consume available CMA space first Message-Id: <20230726130620.7cd312fdd07722f6050e8bb8@linux-foundation.org> In-Reply-To: <20230726150705.GA1365610@cmpxchg.org> References: <20230726145304.1319046-1-hannes@cmpxchg.org> <20230726150705.GA1365610@cmpxchg.org> X-Mailer: Sylpheed 3.8.0beta1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,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 Jul 2023 11:07:05 -0400 Johannes Weiner wrote: > On a memcache setup with heavy anon usage and no swap, we routinely > see premature OOM kills with multiple gigabytes of free space left: > > Node 0 Normal free:4978632kB [...] free_cma:4893276kB > > This free space turns out to be CMA. We set CMA regions aside for > potential hugetlb users on all of our machines, figuring that even if > there aren't any, the memory is available to userspace allocations. > > When the OOMs trigger, it's from unmovable and reclaimable allocations > that aren't allowed to dip into CMA. The non-CMA regions meanwhile are > dominated by the anon pages. > > Movable pages can be migrated out of CMA when necessary, but we don't > have a mechanism to migrate them *into* CMA to make room for unmovable > allocations. The only recourse we have for these pages is reclaim, > which due to a lack of swap is unavailable in our case. > > Because we have more options for CMA pages, change the policy to > always fill up CMA first. This reduces the risk of premature OOMs. This conflicts significantly (and more than textually) with "mm: optimization on page allocation when CMA enabled", which has been languishing in mm-unstable in an inadequately reviewed state since May 11. Please suggest a way forward?