From patchwork Fri Dec 14 23:03:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10731785 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 611E41399 for ; Fri, 14 Dec 2018 23:03:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 13C772D639 for ; Fri, 14 Dec 2018 23:03:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0811E2D63D; Fri, 14 Dec 2018 23:03:35 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C9B2D639 for ; Fri, 14 Dec 2018 23:03:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 02AF88E021B; Fri, 14 Dec 2018 18:03:15 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E0B018E021F; Fri, 14 Dec 2018 18:03:14 -0500 (EST) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A0E528E021E; Fri, 14 Dec 2018 18:03:14 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 4425A8E021B for ; Fri, 14 Dec 2018 18:03:14 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id l45so3463112edb.1 for ; Fri, 14 Dec 2018 15:03:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:from:to:cc :subject:date:message-id:in-reply-to:references; bh=W8Lfqfpa4DlGkxutCqLVK1CDgi6G7m2LALKtQM047S4=; b=m8nlNIjIt7C+scohbZkzlxrxMJuF4QOHYR8jo8zntGC4kOmMQyxoId/B59PR70SPoV VCOZaBYh5HNNrNDNFTqPIylJ4P8+i8j9owQWGolvLGknF27+gFosCud/so8hUF9PLEiL It14PZoAlJ/2+frjjeqw7mQPbMODKfzarkUf0o9OlfAhntQm13j4KTu3IGKk46xXyE1S RwhUaKT/sCR2HJ8g+WsT0A98XLaeJujS/fEbY1CxsoqS6KC3zED5vVbdujda03TO7ZqC 7miewi+iLUfui21H5RS26FtC8BevkSAwzA0HEOunX8SgpqQMBxSWdgfY8MJOt+vtTM0C uEZw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWayFcgS/BeK1CwoiTx0NPVxkL1e9M4iyDugi02/2Lc04bS3qbtE 8Hfz60SMnmJXBcGJ/EhIBaZFo72pmj3DTTO64hS8GQEtp5WU9gsh99KhgU1QY7xZFXDFpUjhJKv bwCecYEPH8fECT25VznMsmDlpBngHSzlXsyZ9m+E9WFMQ/XZPJ7USOrQMTG0VHlwN1Q== X-Received: by 2002:a50:b721:: with SMTP id g30mr4404911ede.155.1544828593773; Fri, 14 Dec 2018 15:03:13 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xe5fm1ZEap2k8/b17wBTufGltuq3mar9sE+KeuGPxWo+uwEnx76JdLAN3SC8Sq92Wk76vD X-Received: by 2002:a50:b721:: with SMTP id g30mr4404891ede.155.1544828592839; Fri, 14 Dec 2018 15:03:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544828592; cv=none; d=google.com; s=arc-20160816; b=F3kNi4s7oOzp8M66zCvLFj/WMBGcqTLwqCVh6KZmbDhHhENYEgHEv7nNH8VDtYYKSW ZHFVRHxfkrjbDn+6aEoNpXwGjvN475FN+iSuyLtSnh8mlHoHyS8nKMYMevoUs9DQen0q O1vbMwHv8rsZjGLOJUelLhSurCjwwMRYumhTQ7/FlPc+QFydmynkdYc863vym4xe6Hs2 OpOQZbRexxxC/pCDrpioMR0D6bY0LWQzbSye9wxi7UpwGefQ2wTEi/9DwptAt8bDJi3i NKrKgvTLPEcM3rMKg+o79qMwKVFq2BXIL4Z8BIGjf0BZvgXsVMUSy+5/VrzTUP7tjm82 v/Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from; bh=W8Lfqfpa4DlGkxutCqLVK1CDgi6G7m2LALKtQM047S4=; b=rHu/0vlX75OwGBb+TjtwqiJdiLZSsUITvYO8klciBaWKcnldGHEKMjZDlhZHcHpyMj 5LvUlQLCtdHQn6lxiE3Vi+31wEBakCsOsbJ1ro7oFvsoOBkDCm16AoDABCwR/qIR7y2b nodj+1tmQTB+uCMSUt4Vmh8fUN/abpVCReRWBRdcWfxJmRYWu5qa94iMZSuBWqeezVwt wi9gYpag9JKGTuACTp/ijZrczJwApll5JoytNrxbL8ioGvfS3n0JIpN8LXRYg4GaucmC 0s6dP/n6+QembDG53S3ElTUJjMp7hCTqXEOSsmvF6mTQOPwIyFGzRbjXCR12r0/p5oJ3 AzMA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp08.blacknight.com (outbound-smtp08.blacknight.com. [46.22.139.13]) by mx.google.com with ESMTPS id e18si316800eds.58.2018.12.14.15.03.12 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 15:03:12 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) client-ip=46.22.139.13; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.13 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp08.blacknight.com (Postfix) with ESMTPS id 82EC91C208A for ; Fri, 14 Dec 2018 23:03:12 +0000 (GMT) Received: (qmail 31280 invoked from network); 14 Dec 2018 23:03:12 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.245.71]) by 81.17.254.9 with ESMTPA; 14 Dec 2018 23:03:12 -0000 From: Mel Gorman To: Linux-MM Cc: David Rientjes , Andrea Arcangeli , Linus Torvalds , Michal Hocko , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing , Mel Gorman Subject: [PATCH 07/14] mm, compaction: Always finish scanning of a full pageblock Date: Fri, 14 Dec 2018 23:03:03 +0000 Message-Id: <20181214230310.572-8-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20181214230310.572-1-mgorman@techsingularity.net> References: <20181214230310.572-1-mgorman@techsingularity.net> 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: X-Virus-Scanned: ClamAV using ClamSMTP When compaction is finishing, it uses a flag to ensure the pageblock is complete. However, in general it makes sense to always complete migration of a pageblock. Minimally, skip information is based on a pageblock and partially scanned pageblocks may incur more scanning in the future. The pageblock skip handling also becomes more strict later in the series and the hint is more useful if a complete pageblock was always scanned. The impact here is potentially on latencies as more scanning is done but it's not a consistent win or loss as the scanning is not always a high percentage of the pageblock and sometimes it is offset by future reductions in scanning. Hence, the results are not presented this time as it's a mix of gains/losses without any clear pattern. However, completing scanning of the pageblock is important for later patches. Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- mm/compaction.c | 19 ++++++++----------- mm/internal.h | 1 - 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 8134dba47584..4f51435c645a 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1338,16 +1338,14 @@ static enum compact_result __compact_finished(struct compact_control *cc) if (is_via_compact_memory(cc->order)) return COMPACT_CONTINUE; - if (cc->finishing_block) { - /* - * We have finished the pageblock, but better check again that - * we really succeeded. - */ - if (IS_ALIGNED(cc->migrate_pfn, pageblock_nr_pages)) - cc->finishing_block = false; - else - return COMPACT_CONTINUE; - } + /* + * Always finish scanning a pageblock to reduce the possibility of + * fallbacks in the future. This is particularly important when + * migration source is unmovable/reclaimable but it's not worth + * special casing. + */ + if (!IS_ALIGNED(cc->migrate_pfn, pageblock_nr_pages)) + return COMPACT_CONTINUE; /* Direct compactor: Is a suitable page free? */ for (order = cc->order; order < MAX_ORDER; order++) { @@ -1389,7 +1387,6 @@ static enum compact_result __compact_finished(struct compact_control *cc) return COMPACT_SUCCESS; } - cc->finishing_block = true; return COMPACT_CONTINUE; } } diff --git a/mm/internal.h b/mm/internal.h index f40d06d70683..9b32f4cab0ae 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -203,7 +203,6 @@ struct compact_control { bool direct_compaction; /* False from kcompactd or /proc/... */ bool whole_zone; /* Whole zone should/has been scanned */ bool contended; /* Signal lock or sched contention */ - bool finishing_block; /* Finishing current pageblock */ }; unsigned long