From patchwork Thu May 25 12:53:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255182 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 C180FC77B7A for ; Thu, 25 May 2023 12:54:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E134900005; Thu, 25 May 2023 08:54:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 56A8A280001; Thu, 25 May 2023 08:54:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 43252900006; Thu, 25 May 2023 08:54:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 33C23900005 for ; Thu, 25 May 2023 08:54:21 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id F0E56AE5AB for ; Thu, 25 May 2023 12:54:20 +0000 (UTC) X-FDA: 80828770680.10.F0BD917 Received: from out30-110.freemail.mail.aliyun.com (out30-110.freemail.mail.aliyun.com [115.124.30.110]) by imf01.hostedemail.com (Postfix) with ESMTP id A685640010 for ; Thu, 25 May 2023 12:54:17 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf01.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.110 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019259; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=3zql6VrCbwQTXhnkE3JZRhUnjSXniNlSH3VFs4iHJ90=; b=NyM2XW1oa10BcGB3XHR3VeDytq6lk0pHqB6gGLbc8EySayyznkzWXmZUGhCqSpZZ86NbSi e6xJXHvgrK58H1Etn7UildiYqTN/afaAdw1lg5UGgwbn3aAJyylmSNzhn3a1GrdTCtLZbW bqMV74Y8uPgY5SsTdTRoFCPiRzjw4rw= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf01.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.110 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019259; a=rsa-sha256; cv=none; b=ubLIfsA3PkAPfh7jPwA5uOeQ8GDoYJIDurv7qb3pMNkB1jd+BR0273wSRqU7xjbDeNm8Dh NqJIXOyh8rPNhM2A49rLRLI+nEvmXBsvCvqwBBx+rFmmF4Vrlz74FeshYwZRFwEx2NBpP8 d+TUvmXEbqZ+BC0Nxi3co+yh+ZPyQH4= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSNUk1_1685019251; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSNUk1_1685019251) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:12 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/6] mm: compaction: drop the redundant page validation in update_pageblock_skip() Date: Thu, 25 May 2023 20:53:56 +0800 Message-Id: <5142e15b9295fe8c447dbb39b7907a20177a1413.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: A685640010 X-Stat-Signature: h85ohcybhamjgto6gtyfrrji9k49rq1o X-Rspam-User: X-HE-Tag: 1685019257-338848 X-HE-Meta: U2FsdGVkX1+0M4wsy+T+lFzfXcTKLLiqcBfmkIW4oHdbedE7fa8U0cn6zTvDlkkXh1gZJFCBz4sLbEb7JrSUZT7Y5tUrqVlxOFPYtHx05tp0ujg4q2LsZS9djkQb+7n0+JqnUIfQrfoSqlPc7OpU2184ph1jyuBlvZUWN1wVGY+L67rZcMiC6TMlXvZ7Z8Chkfv1XrrIYxNmaZE5M56SVvzWXFtSlaNE/ShXuyeaT82LMnvZyqj+uGhgTly0G2mAeoNVR8zhwvMI6b6OSiK/WLQHzdJ7mS+WcUmlc8RG19MnVZZ3YU34ARB4zRfACUB4myAFdBCHtPpTDSjMU/8FuMmr3ofiSXsWFNb04YZ0ghF9gpMSYeVsSdp4jjuxBzIl68qmKKpDIL+MrFdLidbMuYnt0ZDkMT7h2RWxuVsEx9nRdBdnWlHj8MTKm5g3R3JAfqZH+hS00RiHIkV3wfziUZu9JTFB+1SpOTHbO4W4vphxj6K8ok0576Ag2nxkQgEFiy8+plEKe+cdNRb/XM55WQqlUKQADIKRF5wzQoc641Wm5prMvJQYuKWhxDGDZhZBZegO8U1JsNPtx8/9CA5cSVlkEJJKJfLjomi/YWj6WGxqG7+8cd7kbBamAy6FhBkGZFR2eRYhMAYPcVhLyk2pLLJxiyLogrUdRriGui99J1H7TDdx6PDYLQeNTPGkK5DcHiIaUL+ixhIWacVUsLt/YFgFhlCPOfOPg/da1jbjxS5tV/zkKRoxWxScgofUllT9QhLGFTkavo2ZhN6R+LWoaQYis7DevX6Y9HpU2C6xo5XqONxtoGrz3eX9ln4zP0qGqsXF6711m/ZgPQOU0J0BOXix8Rd5iTX0ndtamEc+5NLA6gG9bgV0Zx9oFI1+GQdnUFM0EjIastm2IzZzXvsmO7lBQIqdKe7gQTeYFhazLd4T3fqhc4rnQ/Uore4PI+xgYdon0Vqflka9ha0oBdy v3Ob2drY PrI6PuTTvhpXQKycRpSviKu4S2/OHo+3UWdW5Qwv3OGaF+StW0KZRrp+M2LDHwIp42wo30SUW2yQuENvwl+calTjL82PyGQZpi7qSAYZtvXzFbkkC+ySdi8zp4+W+jNc2kw1MiHuTo2szROo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The caller has validated the page before calling pdate_pageblock_skip(), thus drop the redundant page validation in update_pageblock_skip(). Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 163e2ec70aff..426bb6ce070b 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -436,9 +436,6 @@ static void update_pageblock_skip(struct compact_control *cc, if (cc->no_set_skip_hint) return; - if (!page) - return; - set_pageblock_skip(page); /* Update where async and sync compaction should restart */ From patchwork Thu May 25 12:53:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255181 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 216D7C7EE2D for ; Thu, 25 May 2023 12:54:22 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id F08A3900002; Thu, 25 May 2023 08:54:20 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id EB93A900005; Thu, 25 May 2023 08:54:20 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D813C900002; Thu, 25 May 2023 08:54:20 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id B3C2A900005 for ; Thu, 25 May 2023 08:54:20 -0400 (EDT) Received: from smtpin18.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 6317C140B38 for ; Thu, 25 May 2023 12:54:20 +0000 (UTC) X-FDA: 80828770680.18.3C539D7 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by imf18.hostedemail.com (Postfix) with ESMTP id C63621C0016 for ; Thu, 25 May 2023 12:54:17 +0000 (UTC) Authentication-Results: imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf18.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019258; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=mreEMDSeY2JC7ArjqMMVi/9sS2N/VZgQ7hVIQpjkd4M=; b=NEYzTfab0gowunVSEmZnjpHvpQ1qg+ZgAkz/v4zUHz8F/6I68ib7ovz3/rixuVGnWdR3+X 3X/yTZ/h4Anz848agCK4dq9il8HKEOQXTI9YGpxn+44UEYxeethhu9Pw22Yc3drV2AgvHA 1cJf4fYlC/hh3hEmCtOR2HhL1ZFwiJA= ARC-Authentication-Results: i=1; imf18.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf18.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019258; a=rsa-sha256; cv=none; b=hxxkVK8F0Sn0Y03y/zNsUaxocV9n2REFMMBxGXmP9ZjWsk6Di4c/A52EPqNlhRGAl+o4Hw /DRacRSYgHsn8iVgSeERoN1vMp6b+OUm3Gd18e28XwtTUiUs4a6n0nuGQJoYEObeahzUtX Y91zQEzaVIPPVDpAqkwJhMd6FZ7FM08= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R621e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3fp_1685019252; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3fp_1685019252) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:13 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/6] mm: compaction: change fast_isolate_freepages() to void type Date: Thu, 25 May 2023 20:53:57 +0800 Message-Id: <759fca20b22ebf4c81afa30496837b9e0fb2e53b.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: C63621C0016 X-Stat-Signature: osoa4fxr41tmmhkn3xwye7y3tumoe6n4 X-HE-Tag: 1685019257-356364 X-HE-Meta: U2FsdGVkX1/0Z/IZ6wBbmGyF0ptIS4ER5Xrh+rztzq9Y6txwB6GnkvNjBSfeXvUYD09zrfMsjTw0G87B+aS/g8RQCSnh5Jfmsm3pmpwbURiUkkSnLBlztdAH+ljrzyFtOcrZ3S6MZpIYL4/wbPmH608+vzYXwFS+YRWTX+oY1b+yzpogRHdWMZ70W7pQMxbk+dUdg/ScWLgxAgauuZGlVi8FzJ2wZ1Uoqkn/hnY4SXCMy61WzCkhEbQRG2rPEYBKjgdE0szxs4p58u372DtD6eTvNd4JVJKqTDBTQ7nkTezBSqw/J3/VaOtHq0azCpxw1uuYenzBctfvEFIqM+/WiG73Ap0gFIzdQ+cT++eSW71KF1+J/FqnB/LiZFndLBzXhHjXKBtZizAXRfcJytAHLRtxzdhXCoiWGS2UFL54wEeDMuJ9DO2OPCsUgrllFewW5KbNsMtVfCZqQDOzUg6HvnQd5zTN4XTndvZFaoTrHBg3iiujTj7TSbzc2nHSptkCOWE2tnYx0iudsS3/yQwQ/SDkc6Tkl5t/poWpbHjOzEtJntSbunHBU0/ZBgPul1NUMvSGpij7mLB6OyexSvxyWITyjJ+gCRah1sCOS8GoY8t2mUzCn0xMapZheH0KfNWnaFs88GpDphlF8xd98myCdWd6hmaq5oxB4HTayZhZRfursxUUz2ljOInjMBDKpDmUWWIQ9TjthhQFTwFGzD4aPr8Vs+YLm2yTZ43GkIHt6So9cM+0cuFD81Ng36zNnTvrMMBPvgrheWX89UoR7wKHfbORH7d/I/joqhqqZuTTPIUzp39Rqp1Dr4VjVQsEyceD2HQsKet94NxnRXmQ/qf0rVv0iHBMDadFun+RfZXzsXO7PnUx9BMAjZT70qwSIA/X107ltdwhQAjEW8SwnHLd7oBKcqy2GdBZasJc9rzw8ImuWKRRv/QmRhPmmUb5IBdjYWuij+Jftzv3sa2fiVt dzEaVvAg 7l7rFFs7x9j5j50EWqtGEXj12qxAeKnrqkoMkWWhLQ9LBfFv0GkQRAsYvAhx/NcsGWPb+0l95jPlqvoIqFbD48uhnZhXr2r13xAQ2yv0dJovolOdiLZxRTwc2vTYjKTSdyfscojNadNn7vxM= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: No caller cares about the return value of fast_isolate_freepages(), void it. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 426bb6ce070b..3737c6591bfb 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1435,8 +1435,7 @@ static int next_search_order(struct compact_control *cc, int order) return order; } -static unsigned long -fast_isolate_freepages(struct compact_control *cc) +static void fast_isolate_freepages(struct compact_control *cc) { unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1); unsigned int nr_scanned = 0; @@ -1449,7 +1448,7 @@ fast_isolate_freepages(struct compact_control *cc) /* Full compaction passes in a negative order */ if (cc->order <= 0) - return cc->free_pfn; + return; /* * If starting the scan, use a deeper search and use the highest @@ -1588,11 +1587,10 @@ fast_isolate_freepages(struct compact_control *cc) cc->total_free_scanned += nr_scanned; if (!page) - return cc->free_pfn; + return; low_pfn = page_to_pfn(page); fast_isolate_around(cc, low_pfn); - return low_pfn; } /* From patchwork Thu May 25 12:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255184 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 4FF00C77B7A for ; Thu, 25 May 2023 12:54:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4352C280003; Thu, 25 May 2023 08:54:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 395AC280002; Thu, 25 May 2023 08:54:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25E58280003; Thu, 25 May 2023 08:54:22 -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 1104F280002 for ; Thu, 25 May 2023 08:54:22 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D33131C7AA7 for ; Thu, 25 May 2023 12:54:21 +0000 (UTC) X-FDA: 80828770722.01.B24A36E Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf15.hostedemail.com (Postfix) with ESMTP id 0B503A0016 for ; Thu, 25 May 2023 12:54:17 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019259; a=rsa-sha256; cv=none; b=KNW0rUcLoTHizjberozmTsZGNwjaNtdQnKJ/cM96tJ0IabBTjSHTmU7hM9VBbkEOsVngWd zo/3edEEstWThbCG2gJ8QC3tf4mV7fd0UDPlW90faRflFarHKHNEmB9abp2T/Rvz28DFTn mwG9RiTZry/mhYdVV/UVCMmY2kp+P1A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019259; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=9PEP4Qe0owgriL+os+ebwHktoCpGXaTA8NLjInkUkIw=; b=iSQmQr+uXtRsRwJrPFIWmG84zEF8Dh3+6gr/XC6TzM1yUY+FupFqk2EW8YXbX6UEfWhPd+ F92xFHfc9l4LulolRz7v++4wGKV14NaePJynQxVf4HBOL1OAIKlpMzN68Ygf1ME9QPZW3z Sqi0IFy8tMaU7n13dXwz5d0hFKM7k18= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3gf_1685019253; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3gf_1685019253) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:14 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] mm: compaction: skip more fully scanned pageblock Date: Thu, 25 May 2023 20:53:58 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 0B503A0016 X-Stat-Signature: aj3yjftc7nx3bker18e83em3aihouahi X-HE-Tag: 1685019257-269038 X-HE-Meta: U2FsdGVkX18FAunQUcNQF51cdn73YqFJ0EgDCIOc2hfna2fP/xZekQ3wzQCn+WWCvozlhg212/EQYkKzloN5a7hFU9lI46bnsu8B01ioC3EGV9m0ZK4u3MgbDwKcZGve6jnmZxkSvXYTMDAwHx74v//t0l0C5fApZbdBaYGGqHcr+XaTI3M+cxsABO8Q0k5jKOtbKjxc+bpBxgMubcqLh7xlgI71hui1KAOQFM7PHgDYCSrgzkieMVgyDpHN3MlBqIGES49FDiZqZYndxIvtrqAXFEyq3H8SN5Pe9SiqelEqGmVTCCikwNIP8e1Y9/MF4bwDQcNR8yotul1AXx94HPpwivfVcPK2y205kibI5zSFtyI6Gj390SctLoA9579Y3d99DXQEFAH6mO0220Pw7DfgTLKZzy4dIHIGQcBwD2z0NpMCe0xMgh7DYS/dtt1Ie4MgmDpqXmePIZzxL4j3iP6Ljb7SKIXU7EM8B8srTM3374wjlEdhEBQ2GuMwLGzSHOGXwEZS/560gwSd070QK3FXbzozbGwo44k44ANAOAuXXlMP419saXIuc2InRjsEeTMXXpxLmlHZy1E+9l0LtHZ07+119tMZGP02uSAK++wZUd9XLPj5mmOYbaFR5bq8ZZpoKpuqwRpdxpWYk+HhlJYX0Scft6DYbWYTNOp+DR9AhgTYD1Jgq7WCFExD1/6McufFWp9HfbK9lQ6FlGVF/4fYDxSSer1vZIVllbNEQZ0bHhfb5dUlPi8BXk4/Hsh7fUECdYVzmZZx2Q4aOtenfJeXyTCXcBqwnI2z7ala1zYjgrbcWHqMBxcDYw3HN2A5w0L2nNQ5W4oElBy1tQnF0Hi3DBmdgLatrgpJkNiuhZHN/E/UAQcC/G8nfEDrhFxMCTyDLR38wV9mW6BP48lxpcwGS0ZIc8Ya/pXcWPAtpwacTViKdbykfssMt58rZWQ1bBvMr3zcIKQjtM6hr4M E2Y27Mgq Ox3iqSH8yO8v2+YLho4oWQabBbwk6/jkGFhNUbF6r7lqjwdHU3bTHT52tFsbWxl+Dh7RJsUhb9OGUKpUeCg7t2SALFA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: In fast_isolate_around(), it assumes the pageblock is fully scanned if cc->nr_freepages < cc->nr_migratepages after trying to isolate some free pages, and will set skip flag to avoid scanning in future. However this can miss setting the skip flag for a fully scanned pageblock (returned 'start_pfn' is equal to 'end_pfn') in the case where cc->nr_freepages is larger than cc->nr_migratepages. So using the returned 'start_pfn' from isolate_freepages_block() and 'end_pfn' to decide if a pageblock is fully scanned makes more sense. It can also cover the case where cc->nr_freepages < cc->nr_migratepages, which means the 'start_pfn' is usually equal to 'end_pfn' except some uncommon fatal error occurs after non-strict mode isolation. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index 3737c6591bfb..1e5183f39ca9 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1411,7 +1411,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false); /* Skip this pageblock in the future as it's full or nearly full */ - if (cc->nr_freepages < cc->nr_migratepages) + if (start_pfn == end_pfn) set_pageblock_skip(page); return; From patchwork Thu May 25 12:53:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255183 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 85AF8C7EE2D for ; Thu, 25 May 2023 12:54:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B3B1E280001; Thu, 25 May 2023 08:54:21 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AE9D3280002; Thu, 25 May 2023 08:54:21 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 98A1C280001; Thu, 25 May 2023 08:54:21 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 762BA280002 for ; Thu, 25 May 2023 08:54:21 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id DF07DAE5F1 for ; Thu, 25 May 2023 12:54:20 +0000 (UTC) X-FDA: 80828770680.08.B5CE494 Received: from out30-98.freemail.mail.aliyun.com (out30-98.freemail.mail.aliyun.com [115.124.30.98]) by imf11.hostedemail.com (Postfix) with ESMTP id CA9144000D for ; Thu, 25 May 2023 12:54:18 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019259; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=G6LTpZvzHfBwjs0sQGnuwspELdetmSx1jF49jzAUX2k=; b=XMAlBHbKk5qfXZ2oXryVKDdq0Gwi5dTtyIasOLd35vNibC17AdkN6Vkn6WOMbszS4/5LOK DqPoZ3pxRWkZGohbKSlA6JMD9o4sF8rxWeVUZFTjjMi9tScxovLRnaChJbZ05VTttvL7OD ctiAcYYcn+xw6/kKJWa+YQ2K/26AZYU= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019259; a=rsa-sha256; cv=none; b=DkyDElHarnAfLRQz4JdzC9gHSYiGDZ2VblNjFompE7AFbOvOu12XPTzu0jze5xX07YRG3o oG2z1S8+xgJVHfaR55dIJm8RUev5ZlW4f/JGWbflYkPlihkWzMXTQMJ7MyMs6lOahtEYws xRqEUUA8HZkwrbFtqlqCZPdImbN/Mt8= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=none; spf=pass (imf11.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.98 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3hf_1685019254; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3hf_1685019254) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:15 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/6] mm: compaction: only set skip flag if cc->no_set_skip_hint is false Date: Thu, 25 May 2023 20:53:59 +0800 Message-Id: <0eb2cd2407ffb259ae6e3071e10f70f2d41d0f3e.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: CA9144000D X-Rspam-User: X-Stat-Signature: tw8zbzao96pa8y5cw5ggbkpzpfbji8iy X-Rspamd-Server: rspam03 X-HE-Tag: 1685019258-866050 X-HE-Meta: U2FsdGVkX19ZlsLrBwce27H9kSF25Sdxggsg5N7fo92u9y+Czs72iyH9Tn575L1OXqPccjZ5UwlHNM13v9cj5oY8vZM4cQyGfab+0ejYBY3eBxOY1uH3NfpZIzsvZ1YsIDEMJPqOt+nqUJqEtcYr6gx9y0KQepsV/WuPS7mxxsC+L3LEHKFLJlf8hcNhvF7y6CMLOXTVGjXAU5HkMwxH/p9H1IQH567PnxqVaKGKlK68J+8LSuKj4OgiQumyloJdag+xpMUsMTM1Vr6ekErfxt9M7I6q6/v8J57g6ZNOavgJwbYWEPobbZscfhwtOnuMWgNlYLdRK1Qqfp98Lh7JmqOMTT23VX/UC1kW2LnQq88wS04j4xBy4Yzj/sruQXEpNn8OabGpUZjPmj0r53d89cG1cEvD0AGmlKD7JvI5ndMRzzdGemUpyAoIdZrIkPy9W7rbEdf88ELZJv/cG44UAoso6v8zL3J8JGQgT5/6TyPmTsMA4UTnk/i9Y/nayROHjOEfaQZ0fPl6pMudGLm7e8q0KZfqyhPf9d1f9HxNec9e4rkes9tAOYVO9muJCdHrg6SdLwFZTP9NZ9nF04gujjoAATt1PUdYECSc78BGYYdjhuff08asid5+qC8VIwEnJMZO+wHKQERRsVyTCXHKBicBLKmMrAFk5CDP3304WhTRlV61NzXdW83CkcNDr42tF3hqMWUadzm2gM3ZV/6CyNjlade/1nkmtNuhr7GN8OzKDczqKMpshn55fP9B6gM6NAEiDwF+DzOjW3Q01bMNO1s78w/mdhUsuFvjvQEXHBbNf193JRASgEGznWt3GXRTmhd/DJhZKvmpdmW9WbyN4jptbiVdFSZb4eQlk3csFErdqmyX6B8FoYmYAfZ7pDuj6lU2le+HM3409LjI+K9CNF9GBZPfg0ggBbSBssnwygOw3P2WSOpieWznP4FTE3k658Tjqys31lBpQZUwn1q ZMLT+jBv b/WQFBcHWq/lHh3b2QT246/H9L3MrqkUuI6oMhSx3qJBzjc4eANckfu4Z77VCNsP8lpg0W4uib/rrBnNI/wkc/euk4sc9W21+JlGEu3SRNUT8VtUgWiL+ULQqGMvYZrbCHEon923WZd8ygIo= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: To keep the same logic as test_and_set_skip(), only set the skip flag if cc->no_set_skip_hint is false, which makes code more reasonable. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index 1e5183f39ca9..65d8d9223acc 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1223,7 +1223,7 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, * rescanned twice in a row. */ if (low_pfn == end_pfn && (!nr_isolated || cc->finish_pageblock)) { - if (valid_page && !skip_updated) + if (!cc->no_set_skip_hint && valid_page && !skip_updated) set_pageblock_skip(valid_page); update_cached_migrate(cc, low_pfn); } From patchwork Thu May 25 12:54:00 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255185 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 5EE6CC7EE2D for ; Thu, 25 May 2023 12:54:29 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 08FBA280004; Thu, 25 May 2023 08:54:24 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F2F3F280002; Thu, 25 May 2023 08:54:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5A4F280004; Thu, 25 May 2023 08:54:23 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id C3812280002 for ; Thu, 25 May 2023 08:54:23 -0400 (EDT) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 8722E409F8 for ; Thu, 25 May 2023 12:54:23 +0000 (UTC) X-FDA: 80828770806.19.7B1E50D Received: from out30-112.freemail.mail.aliyun.com (out30-112.freemail.mail.aliyun.com [115.124.30.112]) by imf15.hostedemail.com (Postfix) with ESMTP id 18772A0014 for ; Thu, 25 May 2023 12:54:20 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019261; a=rsa-sha256; cv=none; b=mon1WXKYuBVsEhP6JDz1KtHQChXK6kyvFMEBDw9x5ndpt3dRRW484+tDhMNjpyIyV14vmC UpZtEFwyXPEcLCCSWSEyCwwJhjg0ukfkN+1oXsnjM1A4jVxHDE91zTTk5oh31IUeAcfDsc ikhi7Mu09Q4J8D5A2wFe8hVYsLRqZ88= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.112 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019261; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=SdT5R3m9rZCokN9uO6H95AhoqA+livNaJXRoPZKNaD8=; b=VPCo0UbUoxt3ToqvvBHSxmNlx+wUTzwXZ16WaFPlY8WhFTTCBd4MJ9RpfFuNme5AFQ35ZF LGSnVn84iiARRrcELMDSRG7b4WW+DsN9+LaNuOkmziCqfQZVzlElMQENoOC7gjpM5odajb Wt9Hdtpkj4LotWqQ4+eZNSihJnjwZ8Q= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R781e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSMoYJ_1685019255; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSMoYJ_1685019255) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:16 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/6] mm: compaction: add trace event for fast freepages isolation Date: Thu, 25 May 2023 20:54:00 +0800 Message-Id: <78d2932d0160d122c15372aceb3f2c45460a17fc.1685018752.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 18772A0014 X-Stat-Signature: jor7dn63513dcc9zaopb1zfiu85j1hzz X-HE-Tag: 1685019260-668650 X-HE-Meta: U2FsdGVkX1/lFTD16Js5RL4dbaSLDKymg8i5CE/0RLdsYrLEEcX8F0KW3sA5cqrNeC/OayW9/7o35j0zerSF1zHIFGDzsW/6plUxvnYXHNcvQpTLWngxzVJkVE7X/q3b+jacBs3YiDNK1QyNuFpdyT73Cwd8j4Ktmrwb//JO1jofQYMY9qT83z6wCTMgAmFuoCg++T23bzHjmX9CxgnhuE8IWtrS/sMm5UhsqAY/ir9V/tXJlL4qYkWXYaHD4jSeG8axPA3EjVBUJYtp/fb9u57zA42aZKVaFjT4pZbisuX8R7V6qH6Eac0urRksbYryuMQNCmlTm8wjDNSHI7qO4UO0jUMZSsOF2DWmRTQfDfRTFPblXzOvbKiCUW16wTIp9JIqnDJIzEjayelYg7q//DEua9ktSQcjC8jsJ+mE8TwsLtAubj0ZVBJT+IZcvnl3t2Ni5gXu/OqJPqxJQoAWjpSv7HbWJepEEa8E/NFIvL3+QwZ7uN7Q4gWYbHyfKjmgfaJsq6JX3Jf4Q8kzgX0gHKswnzeVoECrnXLm3bpZhyzYBxSlfvPvYfySnFNZRvaNhzuAqqE4BbNtu9C2CMDSi/dAmucyGuumqNDFDaDoXg5KDJHAR7vO8XCTt3E8Npn/qbQsVfy5K35U8IvF3i+B//fF5l3z8FZlnWxgSH1cpP3rPwn8miE/h4xx3Z9B80foee9qrq8DMBX2DQbzfzAe50axpF90OKhOAI+wF7iuCCDKI52ogtKnSd89RppQRC+wXTJI7kQfQZurPsskVmkDAAuCEEuG6VrbPegWGKflD8RoKc/Dv3nRVCfuie+suo5vYMvA28uWM5gQAoMc/F+0cP+ZpvKrKyaTXQEmDkEw6JSdu0S11tM4saFOm8zxiiOR/ZZJMNsqFqcvqFIWplzQakDnsCPPN9H1axB5Mdsj/K+Bc9lx8u0Ye/CUlK1iWylIj02hax4hZ3chMRsS2z2 nV3wC5bc G90yyKNzNGPlphMkCbAHzAh+TDDyTvyxGM7q7sU1z6KIWhvAFBk/OvLMNlpEfwRnSiufyCtavmLm3Zn5wznIgyAR6Ow== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: The fast_isolate_freepages() can also isolate freepages, but we can not know the fast isolation efficiency to understand the fast isolation pressure. So add a trace event to show some numbers to help to understand the efficiency for fast freepages isolation. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- include/trace/events/compaction.h | 11 +++++++++++ mm/compaction.c | 6 +++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/include/trace/events/compaction.h b/include/trace/events/compaction.h index 3313eb83c117..2b2a975efd20 100644 --- a/include/trace/events/compaction.h +++ b/include/trace/events/compaction.h @@ -64,6 +64,17 @@ DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_isolate_freepages, TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) ); +DEFINE_EVENT(mm_compaction_isolate_template, mm_compaction_fast_isolate_freepages, + + TP_PROTO( + unsigned long start_pfn, + unsigned long end_pfn, + unsigned long nr_scanned, + unsigned long nr_taken), + + TP_ARGS(start_pfn, end_pfn, nr_scanned, nr_taken) +); + #ifdef CONFIG_COMPACTION TRACE_EVENT(mm_compaction_migratepages, diff --git a/mm/compaction.c b/mm/compaction.c index 65d8d9223acc..eccec84dae82 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1438,7 +1438,7 @@ static int next_search_order(struct compact_control *cc, int order) static void fast_isolate_freepages(struct compact_control *cc) { unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1); - unsigned int nr_scanned = 0; + unsigned int nr_scanned = 0, total_isolated = 0; unsigned long low_pfn, min_pfn, highest = 0; unsigned long nr_isolated = 0; unsigned long distance; @@ -1537,6 +1537,7 @@ static void fast_isolate_freepages(struct compact_control *cc) set_page_private(page, order); nr_isolated = 1 << order; nr_scanned += nr_isolated - 1; + total_isolated += nr_isolated; cc->nr_freepages += nr_isolated; list_add_tail(&page->lru, &cc->freepages); count_compact_events(COMPACTISOLATED, nr_isolated); @@ -1557,6 +1558,9 @@ static void fast_isolate_freepages(struct compact_control *cc) limit = max(1U, limit >> 1); } + trace_mm_compaction_fast_isolate_freepages(min_pfn, cc->free_pfn, + nr_scanned, total_isolated); + if (!page) { cc->fast_search_fail++; if (scan_start) { From patchwork Thu May 25 12:54:01 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255186 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 ABA30C7EE31 for ; Thu, 25 May 2023 12:54:30 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id BFF9C280005; Thu, 25 May 2023 08:54:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B111B280002; Thu, 25 May 2023 08:54:25 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8C879280005; Thu, 25 May 2023 08:54:25 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 75366280002 for ; Thu, 25 May 2023 08:54:25 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 0A19840AE3 for ; Thu, 25 May 2023 12:54:25 +0000 (UTC) X-FDA: 80828770890.06.3DD1CF3 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by imf06.hostedemail.com (Postfix) with ESMTP id DE35718001B for ; Thu, 25 May 2023 12:54:22 +0000 (UTC) Authentication-Results: imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019263; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Mn3fhMFcaTYsz7UQ9NrJ1DjTrAq5Xs3DKzZTvyhCQfA=; b=xYdWGzIbJmlTiPa2ERWWiY6W518IAx2Au/+WYl0xJ1inLAyqr5t+g48olE8oWFFrqudDpL eq84AiPNot9Aze87SSZuHEQmUAnYmp0UL0efilThSOGQd5OF8sb6uY+ChR3mWyjrDLkcZp lFW07uaKbtl+iB2tVQwumU1lbmb7Mvo= ARC-Authentication-Results: i=1; imf06.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf06.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.132 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019263; a=rsa-sha256; cv=none; b=clqOlLOJokGQlgw/gHYydL5cmNaqGV8U9DI7IIX5DqWCPQjuOTmtGBXmerlpaZIJZ1A7EP +ODmKHdUeRjdCMOysfSuFz7eYANGtbdVV0nFsPspWwMnKxTIWkYvZJJUHhHIZv/aacUffv ambyu94CjoN6dyuO694cf1+fXdhYvsQ= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R711e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VjSJ3iS_1685019256; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3iS_1685019256) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:17 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/6] mm: compaction: skip fast freepages isolation if enough freepages are isolated Date: Thu, 25 May 2023 20:54:01 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspamd-Queue-Id: DE35718001B X-Rspam-User: X-Rspamd-Server: rspam04 X-Stat-Signature: uhdo1qib7rgc4qgx58cdkhnmtpo8qwjf X-HE-Tag: 1685019262-160674 X-HE-Meta: U2FsdGVkX1+ii7sf21HvGjGYhA4PoTogKUuk/DNF2XIQRKK9nhKG2aGX9XWMhVyoZ0NhhFEIMiuf+KzIGZ/MyhTK7sGqJdl4PgvmEWhbqi3MtAMxu1Bj89ifC1LjUF60d+z5oEU4mKTl7tX0Y+t9CgDNvXKI3YJqwX+/jkpLPFIrIUvrfs+KMCoflHcdXQkCkIzMeQEAlHEOS4sDTPQY5HiRnqCCBdyHsTRyipzv8T3Ki6ok0Mg6P9Rn/GJcO9V2HHo/iy25AojnNi0xoG3a+b2g2XGmmGu7WXPi1YaET9tyAgAjcIIbrJeAWDichHh/RNiMFMxV4XNuZNhg7XjiCL8M8HF11+b5yMfdlpMMdM5zBlw6rux2XSxIeknQe7G2+8YgDgQhGzaDDewrW9dIiJeHWcAaIRb4hFr9QlXsUA9o6TZOH6CJEzz158EF/pvXpdzjoYlMjormK1RcaSUxsoqN98hLQebLuxDtXf3VSHN2IvIbILI7W/oe7moQddEdLNUMB/+O863rU8kTnp7qNtXeS0wxYuigFSvAXJxuD6ORGI6RUKNo07izPpZkoblt1vQq4WZbcNFtUQlfwp5xK7yubfHa6N8ZkWU7xGP/mVyRVDkUmnJEwxZJhIMDICHl8BBVWhMhYowZdUHPOfYpZFafJIAsW2hb02t0/YTYSa1Fkfj1KCQQh+3e1DTFR9CFEGqJFwMqHxdoG6DzW7mjwyRYZjZVXPIhwCIohIRWo7Wo6yY6ZiUa0P5d/RsVKEK5f4KIgFAc6VuwxA9eahdb4WsmxTTjulEd93k2w3h+rJwL5lBblUDyOY0zLS93RlWwINoXmXclnBtuApOgfCQ2u0uYhTzQQaLVM1vzHlcvDIL9BdkW0mGa8/WDpxARYHsferiswTdwxcOXnYq2zp/YOOtafYY5dXmwvTbzLUr/B+cSAdGDc22AUbBSEsq+skkzpoB8sP/r8hd4ciqILGq w/pmZp2C 7Oo/9kkqKI+8svy8IcFNAya2JqzSbDZtq+R06Dg8je4ztre0fFq34gtnC7u6k7TOOP0wT5GW/uY2fyLgKz3u08EnDiw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: I've observed that fast isolation often isolates more pages than cc->migratepages, and the excess freepages will be released back to the buddy system. So skip fast freepages isolation if enough freepages are isolated to save some CPU cycles. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index eccec84dae82..3ade4c095ed2 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1550,6 +1550,10 @@ static void fast_isolate_freepages(struct compact_control *cc) spin_unlock_irqrestore(&cc->zone->lock, flags); + /* Skip fast search if enough freepages isolated */ + if (cc->nr_freepages >= cc->nr_migratepages) + break; + /* * Smaller scan on next order so the total scan is related * to freelist_scan_limit.