From patchwork Sat Jun 26 08:24:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wonhyuk Yang X-Patchwork-Id: 12346333 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=-13.5 required=3.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED,DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT 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 A3067C49EA5 for ; Sat, 26 Jun 2021 08:24:53 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 2D93A61613 for ; Sat, 26 Jun 2021 08:24:53 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2D93A61613 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 248456B0011; Sat, 26 Jun 2021 04:24:52 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 1F8776B005D; Sat, 26 Jun 2021 04:24:52 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 099B66B006C; Sat, 26 Jun 2021 04:24:52 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id CFBD86B0011 for ; Sat, 26 Jun 2021 04:24:51 -0400 (EDT) Received: from smtpin40.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay04.hostedemail.com (Postfix) with ESMTP id BF35416934 for ; Sat, 26 Jun 2021 08:24:51 +0000 (UTC) X-FDA: 78295189182.40.7666103 Received: from mail-pj1-f47.google.com (mail-pj1-f47.google.com [209.85.216.47]) by imf21.hostedemail.com (Postfix) with ESMTP id 72928E000244 for ; Sat, 26 Jun 2021 08:24:51 +0000 (UTC) Received: by mail-pj1-f47.google.com with SMTP id pf4-20020a17090b1d84b029016f6699c3f2so9399136pjb.0 for ; Sat, 26 Jun 2021 01:24:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKdZ0hZscLvwx3fNRlXnkBxGDiozoYm/mePghmjZb2Q=; b=S67azaREByzuBe/kDs6KyXRsFKofnVqQG3gE9PLCBuKOGbJQo9mLH1QHRbWb+wLXO1 H5pnR5q7gYvC22oTCQfPqUIPnRFLozhDFnRIEZ2ZEzAVSQgsvNHxRrcNRYK9+eMvqTGH HBXWjqs0purO/t36naqloo2g2DN3Zet7e7KmOLsPiOlSEO/Vomlw/Dt/snmFfyPXx6cM AkSm7zEHu35lqYZ7gd3mHjADKzLKrqAnqWUppKabZT2EY9S0yp8qO0y1nBsUi13nmStW N5N1Mx62GobOp/OeyLCS3sz1umUtb4/6ndQCoH869FSWetdZAQhAuhEpYl41hgWa1iRW yIJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=sKdZ0hZscLvwx3fNRlXnkBxGDiozoYm/mePghmjZb2Q=; b=kD9N6tSzes63cnah2lFRVlXIOtwRvWteaWQaX7Jv1UyK/C2eZVov+9KYHRU5dRV/7m IJFZyi0cNLoLSSXSjiFXLnPSMEO8KHr0DC1H/kGnBWzmzoP9nON80VCNf4lcDof/PXfp XX1+l1PQlzv2VHcRTRtCBnpWOPLLy6kyUZbpy+ZK0hF8fEDCl4IJbESnBEiKta9sWcaL hL7JEYugQLV6VSu4ZGWqGWQiLeLYPBXDVXfHslN9nK2eUoUQ5cUj3QiSTp+v2bmxFt5X 7GVZsGyzWZ3R9mFSM6gUgRm+UXGcFKgxHxFSmtUdx+SGjGbghmVuNF63WMsxRPvEcdGz SBnQ== X-Gm-Message-State: AOAM532H8cDQGWpQnIaUdNY1Pfl+2gAycL2KlNCGbbwPInC2QYJKIp1v yeDPkDVZFHd73xBYlzILSJbFx+CHafEGhCEftwM= X-Google-Smtp-Source: ABdhPJxFpYHWijP7y8jzQX1GbgsaKSI9fcGiAUHVJYFPoqx+I/QO4QiJFSKbzqgkAz8twCEOLScmUg== X-Received: by 2002:a17:903:304e:b029:11d:41c:fa73 with SMTP id u14-20020a170903304eb029011d041cfa73mr12733820pla.82.1624695890111; Sat, 26 Jun 2021 01:24:50 -0700 (PDT) Received: from dewh-local.. ([125.131.156.99]) by smtp.gmail.com with ESMTPSA id h18sm7649869pgl.87.2021.06.26.01.24.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 26 Jun 2021 01:24:49 -0700 (PDT) From: Wonhyuk Yang To: linux-mm@kvack.org Cc: Mel Gorman , Andrew Morton , Vlastimil Babka , Wonhyuk Yang Subject: [PATCH v2] mm/compaction: fix 'limit' in fast_isolate_freepages Date: Sat, 26 Jun 2021 17:24:43 +0900 Message-Id: <20210626082443.22547-1-vvghjk1234@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=gmail.com header.s=20161025 header.b=S67azaRE; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (imf21.hostedemail.com: domain of vvghjk1234@gmail.com designates 209.85.216.47 as permitted sender) smtp.mailfrom=vvghjk1234@gmail.com X-Stat-Signature: 6sq9ref9ncs5yp1bjzrf9y3mpwopx9wb X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 72928E000244 X-HE-Tag: 1624695891-904653 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: Because of 'min(1, ...)', fast_isolate_freepages set 'limit' to 0 or 1. This takes away the opportunities of find candinate pages. So, by making enough scans available, increases the probability of finding the appropriate freepage. Tested it on the thpscale and the results are as follows. 5.12.0 5.12.0 valnilla 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.0 5.12.0 vanilla patched Ops Compaction migrate scanned 6547133.00 5963901.00 Ops Compaction free scanned 32452453.00 26609101.00 5.12 5.12 vanilla patched Duration User 27.99 28.84 Duration System 244.08 236.76 Duration Elapsed 78.27 78.38 Fixes: 5a811889de10f ("mm, compaction: use free lists to quickly locate a migration target") Signed-off-by: Wonhyuk Yang Acked-by: Mel Gorman --- mm/compaction.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 84fde270ae74..12d5b5a86078 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1380,7 +1380,7 @@ static int next_search_order(struct compact_control *cc, int order) static unsigned long fast_isolate_freepages(struct compact_control *cc) { - unsigned int limit = min(1U, freelist_scan_limit(cc) >> 1); + unsigned int limit = max(1U, freelist_scan_limit(cc) >> 1); unsigned int nr_scanned = 0; unsigned long low_pfn, min_pfn, highest = 0; unsigned long nr_isolated = 0; @@ -1492,11 +1492,11 @@ fast_isolate_freepages(struct compact_control *cc) spin_unlock_irqrestore(&cc->zone->lock, flags); /* - * Smaller scan on next order so the total scan ig related + * Smaller scan on next order so the total scan is related * to freelist_scan_limit. */ if (order_scanned >= limit) - limit = min(1U, limit >> 1); + limit = max(1U, limit >> 1); } if (!page) {