Received: by 2002:a05:7412:da14:b0:e2:908c:2ebd with SMTP id fe20csp644353rdb; Fri, 6 Oct 2023 14:18:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEHcX8TMzGCh4xgMLov6FKUjY2luONdqrft8j7Y5x+batmGdeS4RpGusz0N5RGbrfXtDgNM X-Received: by 2002:a54:4087:0:b0:3ae:8a9:e44a with SMTP id i7-20020a544087000000b003ae08a9e44amr9828669oii.31.1696627089442; Fri, 06 Oct 2023 14:18:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696627089; cv=none; d=google.com; s=arc-20160816; b=GxNKiDlIwMDEjRCuue51RmGCTHPs/3E/1V+urBuBF3LZuEHCYQfhz1CkkVoUItaTjm 30R1oRS6kGqsjOR2+J8UAuB69RmRO9stSCz4yximT6f3tUje8vuv22fWxToRoj20vvGG bqFR6wPV7GVsSwdFdTZTAvaUk3EhU95xpXdjJyaPZzMMOC5U3Z8I1DpLQBph74Ml4Y1V ZeiJvok5TfHYNh9f4zXmJeARAF3OktjlTIc4h9TLlIpJy2ZjOL7bDfJDktg23xlnmkdD HzuJHZg6a5MCEzaHcXB/vLj6rpBWnkHU3gcrexI8IuJUQQFxEFegU/+Yv+XmDJBEhRd7 yiXQ== 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=z8og0TxztvOaaJ/ZCStgyVq6is623do7lSQYZJ6WW2k=; fh=iohd/UhYs4xf28jqCl1hmN4jIo1jqh7Fe5jAnKxpkTU=; b=YxCGow5wvVaADXXJBk7+aTAfd9RISWOg62mPN+8X9pnpXpeKCFK0eFfnqkizLl+r9e vZpqhAjXFLVJYR8tURC+89W/v1hQHFYR6Vo2m+P26/5Gs4ZKnru60H461iHvC4ieUEvP 3vMYNNrBfTw9oKUypPKzDhW3l1HKPMTt1Clmk3RiHOKMBeVm726UrfZIu/F6546+Ogka mCPG2l826Phrc6wyiJueEEolGi+w26elsi5r2Uwprue4F8rcuil7xAp2gsAeqsBixH5y DkNpP//jDQNf8LxipJeLGenbW6huYX8FDAyV71/d+fWLoH4WbWKU+24XzvYJKs91AsFx yGIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=QHDQxPsr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from morse.vger.email (morse.vger.email. [2620:137:e000::3:1]) by mx.google.com with ESMTPS id m63-20020a632642000000b00565ecd01399si4668342pgm.783.2023.10.06.14.18.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 14:18:09 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) client-ip=2620:137:e000::3:1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=korg header.b=QHDQxPsr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:1 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id 4B60B80440D6; Fri, 6 Oct 2023 14:18:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233680AbjJFVR6 (ORCPT + 99 others); Fri, 6 Oct 2023 17:17:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233668AbjJFVR5 (ORCPT ); Fri, 6 Oct 2023 17:17:57 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54205DE for ; Fri, 6 Oct 2023 14:17:55 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 94C5BC433C7; Fri, 6 Oct 2023 21:17:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linux-foundation.org; s=korg; t=1696627074; bh=KTcEpRR2Wu8nzit7cMEeg3GCHgDJhR8cJMCV1xbmfls=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=QHDQxPsrNvXZf4P+vLtc92DHv2/mc+/TbzRW2tYEn4c18ojOEaoLXAy/vj2iYftxz s8lnIjRmN1yack7WXGS/mREdmrYMNqp+e32g3J2oHjrs0WaL8A/61QQGI3JrLd5YhF UDwDaQDetcG/FzUlvyiyOwriGtdKC/E8KehEAY+k= Date: Fri, 6 Oct 2023 14:17:50 -0700 From: Andrew Morton To: "zhaoyang.huang" Cc: Roman Gushchin , Minchan Kim , Roman Gushchin , Joonsoo Kim , , , Zhaoyang Huang , Subject: Re: [PATCHv5] mm: optimization on page allocation when CMA enabled Message-Id: <20231006141750.5423083520f74bc0746fd249@linux-foundation.org> In-Reply-To: <1683782550-25799-1-git-send-email-zhaoyang.huang@unisoc.com> References: <1683782550-25799-1-git-send-email-zhaoyang.huang@unisoc.com> 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=-0.1 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Fri, 06 Oct 2023 14:18:07 -0700 (PDT) On Thu, 11 May 2023 13:22:30 +0800 "zhaoyang.huang" wrote: > From: Zhaoyang Huang > > Let us look at the timeline of scenarios below with WMARK_LOW=25MB WMARK_MIN=5MB > (managed pages 1.9GB). We can find that CMA begin to be used until 'C' under the > method of 'fixed 2 times of free cma over free pages' which could have the > scenario 'A' and 'B' into a fault state, that is, free UNMOVABLE & RECLAIMABLE > pages is lower than corresponding watermark without reclaiming which should be > deemed as against current memory policy. This commit try to solve this by > checking zone_watermark_ok again with removing CMA pages which could lead to a > proper time point of CMA's utilization. > > -- Free_pages > | > | > -- WMARK_LOW > | > -- Free_CMA > | > | > -- > > Free_CMA/Free_pages(MB) A(12/30) --> B(12/25) --> C(12/20) > fixed 1/2 ratio N N Y > this commit Y Y Y > Roman previously asked : Also I'm a bit concerned about potential performance implications. : Would be great to provide some benchmarks or some data. Probably it's : ok because of we have pcp caches on top, but I'm not 100% sure. Are you able to perform such testing and tell us the result? Thanks.