From patchwork Fri Jan 4 12:50:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10748327 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 332BB14E5 for ; Fri, 4 Jan 2019 12:53:09 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 22EAF283C9 for ; Fri, 4 Jan 2019 12:53:09 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 177792844C; Fri, 4 Jan 2019 12:53:09 +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 96E37283C9 for ; Fri, 4 Jan 2019 12:53:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B72E08E00E2; Fri, 4 Jan 2019 07:53:07 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id AFC0D8E00AE; Fri, 4 Jan 2019 07:53:07 -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 9C43A8E00E2; Fri, 4 Jan 2019 07:53:07 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by kanga.kvack.org (Postfix) with ESMTP id 39E728E00AE for ; Fri, 4 Jan 2019 07:53:07 -0500 (EST) Received: by mail-ed1-f69.google.com with SMTP id c3so35319862eda.3 for ; Fri, 04 Jan 2019 04:53:07 -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=mqc/z7vuvN6xwwTBO71f8UjlpUOyDJMtrxPbpJW/JW8=; b=USZJwGC8yjtxq7WN7chVeJ5/R/ZuX3hwre2vH192OzM0qZNrL5XfYIsolvqrXhgl7C YKstq/9SumDGC8o/UYax67zN3b8dyIbURKynimKkyOlsRt8E4cmuHeOAZ4IN8myXsfB8 iN1pDaEFHWXASVt7vq3h0S2qaFNGNCyWdmWFcZq2xpQd4DXnQnvpk1wKuhqAvW48iShn SrfMBtQjLfSNHEqHguMw86cxAfUBq4nb/rJcWLdb33JdF144RjtloujDdEIYrYf0VM72 OffUvZK0bRxYMo7/bsIBr2AQ7OqLehHRJrkaBNge95opCsZeeFmVl3nqmR9m1PjZDfVF vTeQ== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWYupPYnPBz9QZ5X/yK7qIzmNj8DRd2ZH0/2MtW4pDGpphwT8nVk 61OiYZL+fOtYmtEVl5btistpPaSZQjy6ALz6QP5pXQwNJjx+zxghm5TEfzA4foQj15tuk9YmqC3 ruZrLTlSRvpumPHLlIz4Hq7VPB4ScUw6oJn/bVAeaK+y50YDVUmmdC4/gFfo7DkSUjg== X-Received: by 2002:a50:8907:: with SMTP id e7mr47254216ede.252.1546606386720; Fri, 04 Jan 2019 04:53:06 -0800 (PST) X-Google-Smtp-Source: AFSGD/WEapednZ25arxRUbIfM2R+FVKxXwTNCsJGvEE1jhOGZ1TdveEAwmye5uBRhwAEkMk28SE2 X-Received: by 2002:a50:8907:: with SMTP id e7mr47254161ede.252.1546606385614; Fri, 04 Jan 2019 04:53:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546606385; cv=none; d=google.com; s=arc-20160816; b=wc8ypkB/5DAsA+D2GwTo0NoqojAYW673stA/W1k47QNmNAxj7ZM7f7aRFYlTuLnmXF nwVpV9rRWkC0vjY2nHshwZgJG5peuSDI+Z33YuXEC1j7caKwO8yb+UeO/EPeYAZuK7YJ jKx7Zy19ICQ983zJTsU9e0IAqzEVwCCCHOvMU60pbnQieqIFkW8yS5lEB0kB3IPSCIT7 YWoz3zl+bA+WQeDAM2f6PT6y6WczSqGyg4WDzuSQh/FVmRuxZ7FN6hEr7T/iUKUD4yUV IpxU+5mhKlgd8pQOdFdbCmWN1sPFOgM4z37k8Ej8uGX8UGGsdDGNPpTeNM3qL9ra/2JZ 8Rvw== 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=mqc/z7vuvN6xwwTBO71f8UjlpUOyDJMtrxPbpJW/JW8=; b=Ac66/d9U/9iVZ/B9eQzbWoOitjpWNANNR81IFwOHHMeIceVSwknZ/TaJENE6ICfee7 /h77eqBzB+yUgP2S3rzPxlaxCNsYq/jSbKhqFKhGB1Xs6QCrUxFjto3IkM679L7jO+M4 rpn+ZQdeVBBaSNhem5KMYZsh/WRwWiKnkyoiUmWjDmCxRdhUVL/jeNfAt7KnfBMTEuJ6 SP/YsK2ZeKUppZnjbtt2b16J0Vn69S2OOO0LEE1DR2AQE8/sh2wxsOvhYv4KKagBCLwP fRm3041NLBJvo27QNpsBI1MZDF07rimguINVkbW8BhguzJqPSl4ugPaikt6cS0UiCLoo EIIg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp04.blacknight.com (outbound-smtp04.blacknight.com. [81.17.249.35]) by mx.google.com with ESMTPS id k7si7138254edx.327.2019.01.04.04.53.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 04:53:05 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) client-ip=81.17.249.35; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.35 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp04.blacknight.com (Postfix) with ESMTPS id 4A8B1988BA for ; Fri, 4 Jan 2019 12:53:05 +0000 (UTC) Received: (qmail 6206 invoked from network); 4 Jan 2019 12:53:05 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.96]) by 81.17.254.9 with ESMTPA; 4 Jan 2019 12:53:05 -0000 From: Mel Gorman To: Linux-MM Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , ying.huang@intel.com, kirill@shutemov.name, Andrew Morton , Linux List Kernel Mailing , Mel Gorman Subject: [PATCH 16/25] mm, compaction: Check early for huge pages encountered by the migration scanner Date: Fri, 4 Jan 2019 12:50:02 +0000 Message-Id: <20190104125011.16071-17-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190104125011.16071-1-mgorman@techsingularity.net> References: <20190104125011.16071-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 scanning for sources or targets, PageCompound is checked for huge pages as they can be skipped quickly but it happens relatively late after a lot of setup and checking. This patch short-cuts the check to make it earlier. It might still change when the lock is acquired but this has less overhead overall. The free scanner advances but the migration scanner does not. Typically the free scanner encounters more movable blocks that change state over the lifetime of the system and also tends to scan more aggressively as it's actively filling its portion of the physical address space with data. This could change in the future but for the moment, this worked better in practice and incurred fewer scan restarts. The impact on latency and allocation success rates is marginal but the free scan rates are reduced by 32% and system CPU usage is reduced by 2.6%. The 2-socket results are not materially different. Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- mm/compaction.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 608d274f9880..921720f7a416 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1071,6 +1071,9 @@ static bool suitable_migration_source(struct compact_control *cc, { int block_mt; + if (pageblock_skip_persistent(page)) + return false; + if ((cc->mode != MIGRATE_ASYNC) || !cc->direct_compaction) return true; @@ -1693,12 +1696,17 @@ static isolate_migrate_t isolate_migratepages(struct zone *zone, continue; /* - * For async compaction, also only scan in MOVABLE blocks. - * Async compaction is optimistic to see if the minimum amount - * of work satisfies the allocation. + * For async compaction, also only scan in MOVABLE blocks + * without huge pages. Async compaction is optimistic to see + * if the minimum amount of work satisfies the allocation. + * The cached PFN is updated as it's possible that all + * remaining blocks between source and target are suitable + * and the compaction scanners fail to meet. */ - if (!suitable_migration_source(cc, page)) + if (!suitable_migration_source(cc, page)) { + update_cached_migrate(cc, block_end_pfn); continue; + } /* Perform the isolation */ low_pfn = isolate_migratepages_block(cc, low_pfn,