Received: by 2002:a05:7412:bbc7:b0:fc:a2b0:25d7 with SMTP id kh7csp78859rdb; Thu, 1 Feb 2024 02:39:30 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcybLXZO+TR2HjobB10ugc+GoGF8K8ql3tyXGjQCXr+q3mTtg/wyyOEDB8qYK1F8YoF8o6 X-Received: by 2002:a37:e302:0:b0:785:4ea4:f871 with SMTP id y2-20020a37e302000000b007854ea4f871mr178066qki.38.1706783970743; Thu, 01 Feb 2024 02:39:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706783970; cv=pass; d=google.com; s=arc-20160816; b=f9M3Xmz3+PHsvlAiI8OW8ZYEz0+W0jcgFV7md3y+jUkmpPNR19XyJLRVZ3qNKVNaUF i1Ukkwr9Ay0ThSnX24aDrtIXDPmaNdG1tSxj3fB1sTOgebbMn/hLf1NKh48c1Lt9euLe Gn4+2fMpcmQ8zkxgLN9q5JQgMo1Oa32D7Bci5LHjI6Hmbnc1ujxf2sFkDafbUkuMIi+V N9l5k1YVyB/MIk2bS1ddONrcIbfZ3KS/aLAoN5HRvMu38Y6TCxIaOJwSAHjJYTSyZE9p 9N8qP4oYiAlekFdcnxNEO4+obLwcaEbRhOxCdPNMcfDY8xuf4A34r09Ba3U9PgNbaWGt jUCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=Syt9ehLK47D1wjQpiQLA0eymSIqBl2LaipzzbbyoAzk=; fh=uKWyLav7c2j3iVdFAvADiwyuMxcfPipjP0y2ruN0fOA=; b=tIM7/YH47qcA/9FD2ydkdUmfDA2IldqxUoX7j7LMOveYD0vQhpr05T3CIDNXdGSBRY pBwXWgXwFAebesunW1TBqkuFxP6Nqr5x7dA1fj7hjS7WC/RnaP3oC2eB6vALSsVcI1zq Eeh4mOO3IJrNgSjQ6h14cFlWeEbwWAQWfW8LFtiWkwuoJosBluNM7s01P882HmNumc+U 69AKc8Ta6fbp8qxMOVuN2EPs+ZUXUqEU3gjLVdc/Kas0St/mpSQ9saDeFkx+SgQ+5aBt qv8x/KmqQnJKnBGylJOx5azFg8NsQiIi7dhC6pffQjcYZA0HYjsLNDL5Hj9YQY/pRm/9 eEOw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=techsingularity.net); spf=pass (google.com: domain of linux-kernel+bounces-47979-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47979-linux.lists.archive=gmail.com@vger.kernel.org" X-Forwarded-Encrypted: i=1; AJvYcCX5v6G8gzP6/ylJktUlTvCMth0CsMIgI+TVAik1LySY4JHKz2oTwWMZP9zD3IiDjnBp7sTZIyF8TBhXUbejxSZoxuhFcJ4+LkULezXMjw== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id n18-20020ae9c312000000b0078319e53b1csi13403811qkg.412.2024.02.01.02.39.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 01 Feb 2024 02:39:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-47979-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=techsingularity.net); spf=pass (google.com: domain of linux-kernel+bounces-47979-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-47979-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id EBD371C2ABA7 for ; Thu, 1 Feb 2024 10:38:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CC4A05B1E7; Thu, 1 Feb 2024 10:37:55 +0000 (UTC) Received: from outbound-smtp13.blacknight.com (outbound-smtp13.blacknight.com [46.22.139.230]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id AEEEB440E for ; Thu, 1 Feb 2024 10:37:51 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=46.22.139.230 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706783875; cv=none; b=fYIx3BI50x65OiRKW4yzb1EoB8nZVTYeaEPbMvZu5TC6PsUh2hhp3OP4hkoGtnEJ0Zs1jmzuDoy4bOasg0YbsLKaXee4rxK2nvU0eBj1QvZ6WUry96MVjlRuvY7OkhqeKJI9Htaa4RrPLtIks22uMPiXpusqlZWc1S/BqeoExds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706783875; c=relaxed/simple; bh=Exr2BwZvsh3y5wM6YrZoLn/QOAjN5a+Z82NaFBeOZs0=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=nzDgDeerQuAERfwJrPYMcTVUMWQT2wZ5G84rh3LgdR+9tZWrBc9+p9/GinX2RrrHWW0BC2LPwQ4eUJclsl35mpYC/4+F+yEZgv4+kVOv770NpPWmVsph75hSsap4E5urxySxT/WQDG0Rxiq0JlgbiMb/RbMV9a9j3MJgbGfInm0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net; spf=pass smtp.mailfrom=techsingularity.net; arc=none smtp.client-ip=46.22.139.230 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=techsingularity.net Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp13.blacknight.com (Postfix) with ESMTPS id B107F1C3DE2 for ; Thu, 1 Feb 2024 10:30:11 +0000 (GMT) Received: (qmail 1080 invoked from network); 1 Feb 2024 10:30:11 -0000 Received: from unknown (HELO mail.blacknight.com) (mgorman@techsingularity.net@[81.17.254.19]) by 81.17.254.26 with ESMTPA; 1 Feb 2024 10:30:11 -0000 Date: Thu, 1 Feb 2024 10:30:09 +0000 From: Mel Gorman To: Baolin Wang Cc: akpm@linux-foundation.org, vbabka@suse.cz, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] mm: compaction: update the cc->nr_migratepages when allocating or freeing the freepages Message-ID: <20240201103009.jycolrj7t3axtlgd@techsingularity.net> References: <0773058df022fa701b78f9a6dfe3c501a1a77351.1705928395.git.baolin.wang@linux.alibaba.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <0773058df022fa701b78f9a6dfe3c501a1a77351.1705928395.git.baolin.wang@linux.alibaba.com> On Mon, Jan 22, 2024 at 09:01:54PM +0800, Baolin Wang wrote: > Currently we will use 'cc->nr_freepages >= cc->nr_migratepages' comparison > to ensure that enough freepages are isolated in isolate_freepages(), however > it just decreases the cc->nr_freepages without updating cc->nr_migratepages > in compaction_alloc(), which will waste more CPU cycles and cause too many > freepages to be isolated. > > So we should also update the cc->nr_migratepages when allocating or freeing > the freepages to avoid isolating excess freepages. And I can see fewer free > pages are scanned and isolated when running thpcompact on my Arm64 server: > k6.7 k6.7_patched > Ops Compaction pages isolated 120692036.00 118160797.00 > Ops Compaction migrate scanned 131210329.00 154093268.00 > Ops Compaction free scanned 1090587971.00 1080632536.00 > Ops Compact scan efficiency 12.03 14.26 > > Moreover, I did not see an obvious latency improvements, this is likely because > isolating freepages is not the bottleneck in the thpcompact test case. > k6.7 k6.7_patched > Amean fault-both-1 1089.76 ( 0.00%) 1080.16 * 0.88%* > Amean fault-both-3 1616.48 ( 0.00%) 1636.65 * -1.25%* > Amean fault-both-5 2266.66 ( 0.00%) 2219.20 * 2.09%* > Amean fault-both-7 2909.84 ( 0.00%) 2801.90 * 3.71%* > Amean fault-both-12 4861.26 ( 0.00%) 4733.25 * 2.63%* > Amean fault-both-18 7351.11 ( 0.00%) 6950.51 * 5.45%* > Amean fault-both-24 9059.30 ( 0.00%) 9159.99 * -1.11%* > Amean fault-both-30 10685.68 ( 0.00%) 11399.02 * -6.68%* > > Signed-off-by: Baolin Wang Acked-by: Mel Gorman -- Mel Gorman SUSE Labs