Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8200577rwr; Wed, 10 May 2023 20:17:38 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5oytDkcdIo3AilHqE1Nj4EJ3Ouba0AiG61npGWLuTudq9xoYElO8g6Wn0Qb6J4zP3RE/7G X-Received: by 2002:a05:6a20:432b:b0:ff:c184:7c76 with SMTP id h43-20020a056a20432b00b000ffc1847c76mr18346639pzk.24.1683775057869; Wed, 10 May 2023 20:17:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683775057; cv=none; d=google.com; s=arc-20160816; b=kOKUBDALMd6Ip8ds0B1tzZNNxVWoqH2XVZT5Etb/rMgBffOJgqm9T3DCBVzddMAk4w KFtxBzQcymfnZy9ZhdA4s59mIFlH2q9vn5cVJW5sAseAksS/87Cf4OkF3HJWFSfyRjLS qPkZ0hMU7Azv7fqcMqp7XFRVXoAYW6S/4kWl7eekqRQJYcJYtdX75I4NKUM7M50eKXVU oDwRdsUGW2zL4N3ZP0EJSFkMK5bI3pop2ngkz1hqjPv3qG74gQ8sl8+z9YChwxOfMlez fqxBsJh6a7czyyBSqxAb7cy990SnM8UTBEGFqa4cbWSeTHnRpFVkN7ogAl+n/yWEpYWB xIiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=G7rMa9jvL/jm69EPCEihwi6Elw876z+kbt0ES9Rgu6g=; b=FWoyn2ywGQ0BkpH8P4I7T8h3mdf0dQcYA48Xmz35Ko73YMqSaltVrKgHjNAuR17lva OzbJiGbDIc4uXsoMss10ai5QWHDd95e4J3bjwxiLywJrVStIknzkwQ/414tibqcODIIN dbrEVxCcv9j/YID7C2lX4xsW1BvbbE0hE93147txFjVG6kgOkehbmO4cU8TKxngDAyhu eBcumo7r5q7aASsMT4YpRCjWSm5ZLxjf+gQbJL/kDzYMuat0css1HG+saS5if6iyHcEl OXmaTWQ5+drhxSYsue1S/8AJU2eSjUhvxLV/fl8YN9GyMYEGcOsF5HsFOv7w2Av+wQmc v6ag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=kso8xE9n; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bu16-20020a632950000000b0053073585638si802630pgb.570.2023.05.10.20.17.25; Wed, 10 May 2023 20:17:37 -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=@gmail.com header.s=20221208 header.b=kso8xE9n; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231486AbjEKCoQ (ORCPT + 99 others); Wed, 10 May 2023 22:44:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54192 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229500AbjEKCoP (ORCPT ); Wed, 10 May 2023 22:44:15 -0400 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [IPv6:2a00:1450:4864:20::12c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DD42C49F9 for ; Wed, 10 May 2023 19:44:13 -0700 (PDT) Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-4f24ddf514eso5254872e87.0 for ; Wed, 10 May 2023 19:44:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1683773052; x=1686365052; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=G7rMa9jvL/jm69EPCEihwi6Elw876z+kbt0ES9Rgu6g=; b=kso8xE9nDAZhqYv7SjjhFjTmw6sr6VZ2trUU3zhe74uOQAPtXuhcMnM9kUfCh5Xl6K cRvYTiMeHqxiu6gBWHaJSXxe0/QutYfXSzsGg7UikjMaDZQjPf+8Sja2FfrLMZSEXsaJ 1aIUCWXirsSq1tKGR5+3x/H1nDbqLBFQ3Ub+xv/iHTjomsQuFTH0aBW1mloZDi2yxyC7 jEntgyCcDT9N7QN2nPoIyLnrSYOAxPpHTLK0vTYyIRhXwbRfxjkS39qyQ1BIB71iALu+ vl2KlgTAyHMBinGckrHZDCl1EORlU+ji5MxJWg1VPxWAydD60eE6CBYZv6Mk+pKqzyxj bnJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683773052; x=1686365052; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=G7rMa9jvL/jm69EPCEihwi6Elw876z+kbt0ES9Rgu6g=; b=UnFjYfyhl7Rt7gE0552GNRRJHntBVVmAH1JZOYwjUs959rPUXQbtrTRHeSNu6hKjJh yp6JvbfXdDZqtZRHJEaZKQ07OGqZEayteCjTjt6m97gfbX+GLdEFFC6g+QmtN6yHnGok d00qJ97RJimi6LZ4TGypk+IAA23uuw6CXaZh10sMmH66kpu9RVGp+qXIAExOflKpqrhU 0LKdzfwe9ZagzdI1rJp7Gpy4WfCH3hcgEgTBu99HpAQpSBeJMiXZ0Yd0d4lAUAi7m/tw mdfkZIYjuET3+ZApbQ2/D97ZyE/z6YI+ilWtt2FDI/usk/qRf1wodM5zCg+rG5mb9Pwq H8hQ== X-Gm-Message-State: AC+VfDy3QkkLi5hWjCijeOoyN4NonB7NZrDbKbbAV7cS0E2ftBELhv08 HRGsX/BBX1h5TMhrqHLxjzN1zO1jLpVoJDnG3c8= X-Received: by 2002:ac2:5fd2:0:b0:4ed:c61d:c8e8 with SMTP id q18-20020ac25fd2000000b004edc61dc8e8mr2366686lfg.29.1683773051996; Wed, 10 May 2023 19:44:11 -0700 (PDT) MIME-Version: 1.0 References: <1683685251-2059-1-git-send-email-zhaoyang.huang@unisoc.com> In-Reply-To: From: Zhaoyang Huang Date: Thu, 11 May 2023 10:43:48 +0800 Message-ID: Subject: Re: [PATCHv4] mm: optimization on page allocation when CMA enabled To: Roman Gushchin Cc: "zhaoyang.huang" , Andrew Morton , Roman Gushchin , Minchan Kim , Joonsoo Kim , linux-mm@kvack.org, linux-kernel@vger.kernel.org, ke.wang@unisoc.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,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 Thu, May 11, 2023 at 6:08=E2=80=AFAM Roman Gushchin wrote: > > On Wed, May 10, 2023 at 10:20:51AM +0800, zhaoyang.huang wrote: > > From: Zhaoyang Huang > > > > Let us look at the series of scenarios below with WMARK_LOW=3D25MB,WMAR= K_MIN=3D5MB > > (managed pages 1.9GB). We can know that current 'fixed 1/2 ratio' start= to use > > CMA since C which actually has caused U&R lower than WMARK_LOW (this sh= ould be > > deemed as against current memory policy, that is, UNMOVABLE & RECLAIMAB= LE should > > either stay around WATERMARK_LOW when no allocation or do reclaim via e= ntering > > slowpath) > > > > -- 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 > > > > Signed-off-by: Zhaoyang Huang > > I'm mostly fine with the code. The commit message is still very confusing= to me, > not sure I understand what exactly this table means. And you still use "U= &R". I would like to highlight the scenario "A&B" where the previous fixed 1/2 ratio introduces over use of UNMOVABLE & RECLAIMABLE. I will try to make it more clear by v5 > > 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% s= ure. This patch helps solve my OOM issue in v5.15. Actually, It inherit the logic of 1/2 ratio and just behave differently when free pages is around corresponding watermark > > Thanks!