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=-7.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=no 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 E682EC49EA6 for ; Sat, 26 Jun 2021 07:17:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 6DF8B61939 for ; Sat, 26 Jun 2021 07:17:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6DF8B61939 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 056216B0011; Sat, 26 Jun 2021 03:17:57 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F20B46B005D; Sat, 26 Jun 2021 03:17:56 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D72C66B006C; Sat, 26 Jun 2021 03:17:56 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0193.hostedemail.com [216.40.44.193]) by kanga.kvack.org (Postfix) with ESMTP id A0E886B0011 for ; Sat, 26 Jun 2021 03:17:56 -0400 (EDT) Received: from smtpin30.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay02.hostedemail.com (Postfix) with ESMTP id AFFAF11008 for ; Sat, 26 Jun 2021 07:17:56 +0000 (UTC) X-FDA: 78295020552.30.F941531 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) by imf22.hostedemail.com (Postfix) with ESMTP id 75E1DC01C086 for ; Sat, 26 Jun 2021 07:17:56 +0000 (UTC) Received: by mail-lf1-f50.google.com with SMTP id t17so20546358lfq.0 for ; Sat, 26 Jun 2021 00:17:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bX6bNsYH5vniRcDZBshjbGxy0n832m9pp1jttFhEZ2M=; b=BcDmznXM1uWsYS4phIolc1nNs9SWnk/QW2y1RaGhdfGjPZt1QIGluUse+SQhC45nVD 3Fh+t35vJREPy4pjIw9K09Z8IT0LG4cf3jqfwfUSOo+T8OU73VstLxt3D2CYYQGWjSrU 9jmBnTX2HXeNMqViceTcSFt08cyAFGIMHOBYCkLp8+bOkuRDiVU1zlIvlPhShU55jDUP pu+KU8aTsVUaLD/v1lfsPBOGNn3OIYvNX/l/8JyMWALkL4jqBQw8M7nIpF10KOHJuYDF DiCh4OL1MB6SpP6d7yPrKCrUecSxApSFgVYlOI7B/3cVZ3KQgZyimGMYhMMfIBStSCP3 o+zw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bX6bNsYH5vniRcDZBshjbGxy0n832m9pp1jttFhEZ2M=; b=P8K/mezkbZPAgcWQAs4BTOUJ4CfIyJsQScEzAs2Bvy5wh3Sekw69pYdVcmPsQO4Qc3 yEnfoqm9t/Dpnlrl5xa/TektNAc8SoG8aF50tvpp3ICDFVPcxX/NWsOIs54uEs/rQCHy BRwiyHjHr1/aZGyAcKOWb3sVqFslQAg3S0a9ycDt7H/O0ZzfQiCHaQ4PhTrRpchW29Pb RtFvWGYokLuRW0fg1CatMzmEQoU3EmxHJsOELu9w2JrqzxfgCPL6S7s30B7r8MpSeF/J 7U8NG5anOMLLiEgjqLkxCoT+mdrrk1rI3chQV8dGk6CUvL5SKaxlOnvUZQI3sjBGO2HX QCbg== X-Gm-Message-State: AOAM530FiuxfTmoWYdKM7b8BgueJ3wVitPN/HMXoOQGr6q6VKDeAHW9h dG8sQmahSpwbGCeGwFGVYOEfItjFa3OXJCjvKsc= X-Google-Smtp-Source: ABdhPJzY3TGaSHXTGV7BCeoZ7dA3z0RhcjeCG8r+YFUDOPHRy0bPI93aiPp1y2q8BA58TYhCU6oGgxE7WgC/2LRss6Q= X-Received: by 2002:ac2:5f67:: with SMTP id c7mr9775718lfc.310.1624691874827; Sat, 26 Jun 2021 00:17:54 -0700 (PDT) MIME-Version: 1.0 References: <20210620145742.54565-1-vvghjk1234@gmail.com> <20210623091509.GV30378@techsingularity.net> <20210625102102.GW30378@techsingularity.net> In-Reply-To: <20210625102102.GW30378@techsingularity.net> From: Wonhyuk Yang Date: Sat, 26 Jun 2021 16:17:43 +0900 Message-ID: Subject: Re: [PATCH] mm, compaction: fix 'limit' in fast_isolate_freepages To: Mel Gorman Cc: linux-mm@kvack.org, Andrew Morton , Vlastimil Babka Content-Type: text/plain; charset="UTF-8" Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=BcDmznXM; spf=pass (imf22.hostedemail.com: domain of vvghjk1234@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=vvghjk1234@gmail.com; dmarc=pass (policy=none) header.from=gmail.com X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 75E1DC01C086 X-Stat-Signature: ozkhk7byi7uqbduui7eadadjqhtitapj X-HE-Tag: 1624691876-327744 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: On Fri, Jun 25, 2021 at 7:21 PM Mel Gorman wrote: > 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. > Okay, I'll do that.