From patchwork Fri Jan 18 17:51:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10771379 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 922E313B4 for ; Fri, 18 Jan 2019 17:54:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 80357285CC for ; Fri, 18 Jan 2019 17:54:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 73E23286B2; Fri, 18 Jan 2019 17:54:13 +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 E2293285CC for ; Fri, 18 Jan 2019 17:54:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id DEDC38E001D; Fri, 18 Jan 2019 12:54:11 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id D9DE58E0002; Fri, 18 Jan 2019 12:54:11 -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 C646C8E001D; Fri, 18 Jan 2019 12:54:11 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by kanga.kvack.org (Postfix) with ESMTP id 69E558E0002 for ; Fri, 18 Jan 2019 12:54:11 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id c18so5125896edt.23 for ; Fri, 18 Jan 2019 09:54:11 -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=ob00ivw8MGpNGXusnKzOvKzjGg/MG1s7CTxxOGMVEys=; b=a05KyptPkFGUQ5mzRCv2OdB6eiLfUksMJePfVSe2hLSmz+WcTYGC58qXyBUft2Yi6j ZnpdTTiFNZPDB7MrPMkCiAAZV4aoyY4+n6a1ZiFDIWaTHCJK77E0bbmfEUUR2N1WNPcK Zr9n2kE385tAIRygBTWE167JGlO3xT0FuViz7dPb+dRtLmDqG007JAzj33yVV3UxFJQi o/+OXWoUKMNcppVDBFTPWP2Kq8NeTAt/sHmCRuY8IdGll1BwMGYjtWTzqEMlWhkoO68h +aljcRCc57Ku9vApdB1JvcbKfp3jw9zDKpqH1iE3VdMtsX+ahvqa0u4Esc2juKmbXEzE BSfw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AJcUukfEdi+nQHOcfjemBfAyNeQD3ZbzaHRwn0T4IynuPZHpmMFQYaIl E7KVAzT886USUQrTkRE8lT6r3ayPB5tf3aYGYVIdaLUiAj+b7/EFVP//LS5p2wl+Tn9z7GVh/c6 E0AXXqsCtTrLgnHcNE/7svjbxukpNW9lXbGRbXDbELikBVf0kVvSgZJE+J5i4zH8UEQ== X-Received: by 2002:aa7:d597:: with SMTP id r23mr17141630edq.51.1547834050811; Fri, 18 Jan 2019 09:54:10 -0800 (PST) X-Google-Smtp-Source: ALg8bN5cDvYNBim+QEMM2D0HKMTALMj9rZeHONbH9VoeEE/NJdWxZFBbWxC1J1kbEYkszzO2fhGl X-Received: by 2002:aa7:d597:: with SMTP id r23mr17141572edq.51.1547834049764; Fri, 18 Jan 2019 09:54:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547834049; cv=none; d=google.com; s=arc-20160816; b=yYeWbDqHORJBVYC1KhKytfq378OSJQhjRSNS6RxbmkCQuWt5E69uvEMH9ditseSUpX 4wOgP1jAsaui953c5nBjBsy02675UdFeIwewmHoCDk4+DcONMAtT7JE/F3VvZyjgeSU8 yvbAP6TF+NWOxXAG/zEdIl+rYTsj/nhhr1wbbKb/c9PbxH/kBZvk56n3btCSMflEiCmb oGLmYTJuRWpqir4XI2oduHByS+pchaheTeHLq+dnneZaQ8mfJJcAncqEqbYcfxwT8NGg /CdQWiQrAYyhp8gRgNYP9tzFXUI5/Fiyn+bsEN8M7U/dJIrJy+OP3/p27Q+n+AHouW9Y MAJQ== 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=ob00ivw8MGpNGXusnKzOvKzjGg/MG1s7CTxxOGMVEys=; b=YCX9KU9fT2PzoXpsUi4HC3V341zxOm/uG49umgxz5jRmI6xl0WdU3rCWZVrjbi9ITo Vz4yjIlVW7BYU6xFUCFWde7gYQxTHJsTerxb5HIjetrXsZp8FSNi8JE7efvnjQdPC+vR L3X6gRDLSEoWia+YtTEOTUT1y+1lfBFN7vkh4HIGB5ExIeu+HQ7hl5BytDjWCt2yFVga C0Sd+s/sTHTizerSHP02OZb57L4fxvB0UGOa2QvqEPwthseWbCvf8lCa0R68xQOM63yq bPfw5le394JrlktPwgTd7CYjen8Fu/tsASHOzc9lAEu5eCftV9F3EzyD/bfckWONyobc srXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp02.blacknight.com (outbound-smtp02.blacknight.com. [81.17.249.8]) by mx.google.com with ESMTPS id b12si1459128edb.125.2019.01.18.09.54.09 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:54:09 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) client-ip=81.17.249.8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 81.17.249.8 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp02.blacknight.com (Postfix) with ESMTPS id 744DE98C38 for ; Fri, 18 Jan 2019 17:54:09 +0000 (UTC) Received: (qmail 5490 invoked from network); 18 Jan 2019 17:54:09 -0000 Received: from unknown (HELO stampy.163woodhaven.lan) (mgorman@techsingularity.net@[37.228.229.96]) by 81.17.254.9 with ESMTPA; 18 Jan 2019 17:54:09 -0000 From: Mel Gorman To: Andrew Morton Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , Linux List Kernel Mailing , Linux-MM , Mel Gorman Subject: [PATCH 14/22] mm, compaction: Check early for huge pages encountered by the migration scanner Date: Fri, 18 Jan 2019 17:51:28 +0000 Message-Id: <20190118175136.31341-15-mgorman@techsingularity.net> X-Mailer: git-send-email 2.16.4 In-Reply-To: <20190118175136.31341-1-mgorman@techsingularity.net> References: <20190118175136.31341-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 15% and system CPU usage is reduced by 3.3%. 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 b261c0bfac24..14bb66d48392 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1061,6 +1061,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; @@ -1695,12 +1698,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 unsuitable + * 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,