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 X-Spam-Level: X-Spam-Status: No, score=-10.2 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 00A4FC2B9F4 for ; Fri, 25 Jun 2021 10:21:09 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 45EFC6143D for ; Fri, 25 Jun 2021 10:21:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 45EFC6143D Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=techsingularity.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 400786B0036; Fri, 25 Jun 2021 06:21:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 3D7806B005D; Fri, 25 Jun 2021 06:21:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2C6AD6B006C; Fri, 25 Jun 2021 06:21:07 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0168.hostedemail.com [216.40.44.168]) by kanga.kvack.org (Postfix) with ESMTP id EFF056B0036 for ; Fri, 25 Jun 2021 06:21:06 -0400 (EDT) Received: from smtpin36.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay01.hostedemail.com (Postfix) with ESMTP id 1DC8D182104D8 for ; Fri, 25 Jun 2021 10:21:07 +0000 (UTC) X-FDA: 78291853374.36.758595E Received: from outbound-smtp02.blacknight.com (outbound-smtp02.blacknight.com [81.17.249.8]) by imf23.hostedemail.com (Postfix) with ESMTP id 37DB6A000263 for ; Fri, 25 Jun 2021 10:21:06 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 41954BAC5D for ; Fri, 25 Jun 2021 11:21:04 +0100 (IST) Received: (qmail 26736 invoked from network); 25 Jun 2021 10:21:04 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.255]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 25 Jun 2021 10:21:04 -0000 Date: Fri, 25 Jun 2021 11:21:02 +0100 From: Mel Gorman To: Wonhyuk Yang Cc: linux-mm@kvack.org, Andrew Morton , Vlastimil Babka Subject: Re: [PATCH] mm, compaction: fix 'limit' in fast_isolate_freepages Message-ID: <20210625102102.GW30378@techsingularity.net> References: <20210620145742.54565-1-vvghjk1234@gmail.com> <20210623091509.GV30378@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Authentication-Results: imf23.hostedemail.com; dkim=none; spf=pass (imf23.hostedemail.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net; dmarc=none X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 37DB6A000263 X-Stat-Signature: oxza3qpy9ed8aox3345yfs79oihzdfpx X-HE-Tag: 1624616466-238340 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000018, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Thu, Jun 24, 2021 at 11:18:57PM +0900, Wonhyuk Yang wrote: > On Wed, Jun 23, 2021 at 6:15 PM Mel Gorman wrote: > > > > On Sun, Jun 20, 2021 at 11:57:42PM +0900, Wonhyuk Yang wrote: > > > Because of 'min(1, ...)', fast_isolate_freepages set 'limit' > > > to 0 or 1. This takes away the opportunities of find candinate > > > pages. Also, even if 'limit' reaches zero, it scan once. It is > > > not consistent. So, modify the minimum value of 'limit' to 1. > > > > > > > The changelog could do with a little polish. > > > > In addition, what were the effects of this and what load did you use to > > evaluate it? While your patch is mostly correct, it has the potential > > side-effect of increasing system CPU usage in some cases and I'm curious > > to hear what you observed. Minimally it is worth noting in the changelog > > that there is a risk of increasing system CPU usage but that there are > > advantages too. Describe them in the changelog in case a regression > > bisects to your patch. > > I tested it on the thpscale and the results are as follows. > > 5.12 > 5.12 > vanilla > patched > Amean fault-both-1 598.15 ( 0.00%) 592.56 ( 0.93%) > Amean fault-both-3 1494.47 ( 0.00%) 1514.35 ( -1.33%) > Amean fault-both-5 2519.48 ( 0.00%) 2471.76 ( 1.89%) > Amean fault-both-7 3173.85 ( 0.00%) 3079.19 ( 2.98%) > Amean fault-both-12 8063.83 ( 0.00%) 7858.29 ( 2.55%) > Amean fault-both-18 8781.20 ( 0.00%) 7827.70 * 10.86%* > Amean fault-both-24 12576.44 ( 0.00%) 12250.20 ( 2.59%) > Amean fault-both-30 18503.27 ( 0.00%) 17528.11 * 5.27%* > Amean fault-both-32 16133.69 ( 0.00%) 13874.24 * 14.00%* > > > 5.12 5.12 > > vanilla patched > Ops Compaction migrate scanned 6547133.00 5963901.00 > Ops Compaction free scanned 32452453.00 26609101.00 > Ok, mention this in the changelog and maybe include the overall system CPU usage as well. It will be higher but should be acceptable. > One thing to worry about is that the results are very different every time. > Is there any precise way to measure this patch? > Not with this workload, it was designed to simply hammer compaction heavily to see if latencies were unacceptably high and also for tracing various compaction corner cases. > > > @@ -1456,7 +1456,7 @@ fast_isolate_freepages(struct compact_control *cc) > > > high_pfn = pfn; > > > > > > /* Shorten the scan if a candidate is found */ > > > - limit >>= 1; > > > + limit = max(1U, limit >> 1); > > > } > > > > > > if (order_scanned >= limit) > > > > This hunk should be dropped. Once a candidate free page has been > > identified, it's ok to decay the limit to 0. This hunk introduces a risk > > of increasing system CPU usage unnecessarily. > > Yes, you are right. I'll take your opinion. > Thanks. > > > @@ -1496,7 +1496,7 @@ fast_isolate_freepages(struct compact_control *cc) > > > * to freelist_scan_limit. > > > */ > > > if (order_scanned >= limit) > > > - limit = min(1U, limit >> 1); > > > + limit = max(1U, limit >> 1); > > > } > > > > The change is fine but I have a minor nitpick that you are free to > > ignore. The comment above this block has a typo. > > > > s/scan ig related/scan is related/ > > > > Ordinarily patches to fix spelling are ignored but you are altering this > > area anyway and it's helpful to see the full comment when reviewing this > > patch. I think it would be harmless to fix the spelling in the context > > of this patch. > > Okay, I'll fix this as well. > > Thank you for your review. No problem, thank you for the patch. Please cc me on v2 and I'll rerun some tests just to be sure before acking it. -- Mel Gorman SUSE Labs