From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 74711EB64D9 for ; Wed, 14 Jun 2023 09:55:15 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8A4D6B0074; Wed, 14 Jun 2023 05:55:14 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D39316B0075; Wed, 14 Jun 2023 05:55:14 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id C271D6B0078; Wed, 14 Jun 2023 05:55:14 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id AFC626B0074 for ; Wed, 14 Jun 2023 05:55:14 -0400 (EDT) Received: from smtpin05.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 6AA47C0907 for ; Wed, 14 Jun 2023 09:55:14 +0000 (UTC) X-FDA: 80900895348.05.F299D3C Received: from outbound-smtp10.blacknight.com (outbound-smtp10.blacknight.com [46.22.139.15]) by imf27.hostedemail.com (Postfix) with ESMTP id 5843A4000F for ; Wed, 14 Jun 2023 09:55:12 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1686736512; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=lBYAQheftX/Lqd7W08UnzgQ6ZQZm8o3C4a/k0Hrvqrg=; b=OhkI7bx5yx/4HfrcUPVRxV9+FetPiXR/vHNjvFvSw6iJ+rRFxFVvrkIHOQSwmKVp1Fch8h 3T/MsFigj+Pl9Dy+vfSuGZFD1gr0UbaNQ0wnVEljw4dqBcCtr/I85I/8wVzIWNzxJyvpvv I6A5Acy4RMc6RV9RGl5G5Yjxbd9KLiI= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1686736512; a=rsa-sha256; cv=none; b=aBeFEgrs8kgs1LCAq5js8Z4LuKh/4+IB+nVP6kLk9tZ8KhA52jb9BvjuSdUsEp9R8+IxGk HWpA489gEv9DpmdEzKSItUtiowBgWZR8qKdra6/9JJgu2PJXH+/9SRYV0yaTK+I0j8XzhX T1H2ZBaDfSt9Qp882V8CKJtpU/vHEbc= ARC-Authentication-Results: i=1; imf27.hostedemail.com; dkim=none; spf=pass (imf27.hostedemail.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp10.blacknight.com (Postfix) with ESMTPS id 1E1561C3B0F for ; Wed, 14 Jun 2023 10:55:10 +0100 (IST) Received: (qmail 24175 invoked from network); 14 Jun 2023 09:55:09 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.21.103]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 14 Jun 2023 09:55:09 -0000 Date: Wed, 14 Jun 2023 10:55:01 +0100 From: Mel Gorman To: Baolin Wang Cc: akpm@linux-foundation.org, vbabka@suse.cz, david@redhat.com, ying.huang@intel.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] mm: compaction: skip memory hole rapidly when isolating migratable pages Message-ID: <20230614095501.m4porztaibchrgwx@techsingularity.net> References: <770f9f61472b24b6bc89adbd71a77d9cf62bb54f.1686646361.git.baolin.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <770f9f61472b24b6bc89adbd71a77d9cf62bb54f.1686646361.git.baolin.wang@linux.alibaba.com> X-Rspamd-Queue-Id: 5843A4000F X-Rspam-User: X-Stat-Signature: kizks5z4ojsnkuxsdkknyghexzjjeg4e X-Rspamd-Server: rspam03 X-HE-Tag: 1686736512-975946 X-HE-Meta: U2FsdGVkX18VVmZHPNc1h1fytvAAv3TSbr1JpINJueQn7D7GiQbWzp4+cEQiy+JJlp0mwbozQf02atWn4/h3LphmirE2Ss/zY1rha85nyfX66Od/uGsMS+jHvMaktzDjj8kXwVTYJBrA45fKjqx9l23ghhNsYTa8OstWNbPBe2mbOsSM70HTRC7lfoPeG5ojD0iRgv8AsaWllNvKA9jvAaSdB4Ks5JMDdbMeWRDCf59NeVRoDxh3CajVLrXdz18Z/HEN4s67eUPHtjPjSYaFbew8Eraim6IyTGOeKcujghExULff0nXnnwrrVFNl7PoONH0L22r2UJGat+YpAXZOJhQKpLPwOTEZjggukv6lKQKgXzprcWUhqCDzfjrs/VxweZ37OkwZvWfTJDy6Uu0VsBvb/heFp+y7RYkSOiWFWSvYkxSiVw5t74EpEL5MRIwEBvyxPDwMniwrunz2/o5gpvpgg9jZACq+VD8tWNphvHSFnWfmtBTX/aaoo2YP+FK1RIewxeBOZvMi+suz31Q1V3QfhrHw8nnsFfl3Du0rXePls0VUAvcvUrWkkvH7XJ+AUTrFCd3XO1XoLrjU9BJsRpPu+yIP8wwzfl0kAWxKnwjKEKAdyjE9f8d8Ck2AqI3mLvSb+yUd+ikWpFrEwWy7JiHB9+IZATfodKRT4H8FCb1tIcPW45lEWH1EndSTNlSl5d9DlilYNqWX1OAZI3k6Xol0VEu2I4ZRDxvLMBp5VClU76VNRjc7Le50qsQiYDe8yHT5JnGJjyb8OKgvLJKim9l2iptF3hn386cIgUe93m9REEuR8XPYPX/JzfQm2N5DfOKwcXtBrADVHyrjfAP76eCXGSxF9cNHTMpNecOp7TjkIzE/6IPBm35Znk1051crtyaaEoa+a3th8MhjN0hnIAb0JUOgSQS365k+tTPXETa2ORtTUOK+6SNk+YR5K0Azz6Kx0+LNdXnW4k3kzDy hj1PXews jdrQL9q5qlldysE62Ly+y3WSIVSs9Kqc9kEBhOPthbp2yFn5f9S3crGqVsVk9jYzs4t1EStzeKL9MI32Weg9iV2a+otXvx92F2eofuqcFEVv9CQDV+4aQSKTvtVPtSmJYRiqBpTBp+Z6T32OQ/NB1gpO3DL2NMySTPR/Q6gQ2LUs0l7+hYrcvGiaeCy497p8CVbxh X-Bogosity: Ham, tests=bogofilter, spamicity=0.000005, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Tue, Jun 13, 2023 at 04:55:04PM +0800, Baolin Wang wrote: > On some machines, the normal zone can have a large memory hole like > below memory layout, and we can see the range from 0x100000000 to > 0x1800000000 is a hole. So when isolating some migratable pages, the > scanner can meet the hole and it will take more time to skip the large > hole. From my measurement, I can see the isolation scanner will take > 80us ~ 100us to skip the large hole [0x100000000 - 0x1800000000]. > > So adding a new helper to fast search next online memory section > to skip the large hole can help to find next suitable pageblock > efficiently. With this patch, I can see the large hole scanning only > takes < 1us. > > [ 0.000000] Zone ranges: > [ 0.000000] DMA [mem 0x0000000040000000-0x00000000ffffffff] > [ 0.000000] DMA32 empty > [ 0.000000] Normal [mem 0x0000000100000000-0x0000001fa7ffffff] > [ 0.000000] Movable zone start for each node > [ 0.000000] Early memory node ranges > [ 0.000000] node 0: [mem 0x0000000040000000-0x0000000fffffffff] > [ 0.000000] node 0: [mem 0x0000001800000000-0x0000001fa3c7ffff] > [ 0.000000] node 0: [mem 0x0000001fa3c80000-0x0000001fa3ffffff] > [ 0.000000] node 0: [mem 0x0000001fa4000000-0x0000001fa402ffff] > [ 0.000000] node 0: [mem 0x0000001fa4030000-0x0000001fa40effff] > [ 0.000000] node 0: [mem 0x0000001fa40f0000-0x0000001fa73cffff] > [ 0.000000] node 0: [mem 0x0000001fa73d0000-0x0000001fa745ffff] > [ 0.000000] node 0: [mem 0x0000001fa7460000-0x0000001fa746ffff] > [ 0.000000] node 0: [mem 0x0000001fa7470000-0x0000001fa758ffff] > [ 0.000000] node 0: [mem 0x0000001fa7590000-0x0000001fa7ffffff] > > Signed-off-by: Baolin Wang This may only be necessary for non-contiguous zones so a check for zone_contiguous could be made but I suspect the saving, if any, would be marginal. However, it's subtle that block_end_pfn can end up in an arbirary location past the end of the zone or past cc->free_pfn. As the "continue" will update cc->migrate_pfn, that might lead to errors in the future. It would be a lot safer to pass in cc->free_pfn and do two things with the value. First, there is no point scanning for a valid online section past cc->free_pfn so terminating after cc->free_pfn may save some cycles. Second, cc->migrate_pfn does not end up with an arbitrary value which is a more defensive approach to any future programming errors. -- Mel Gorman SUSE Labs