From patchwork Fri Jan 18 17:51:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10771381 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 B9A5B6C5 for ; Fri, 18 Jan 2019 17:54:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A9B402FF7F for ; Fri, 18 Jan 2019 17:54:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E1342FFB8; Fri, 18 Jan 2019 17:54:23 +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 276092FF7F for ; Fri, 18 Jan 2019 17:54:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1E0BC8E001E; Fri, 18 Jan 2019 12:54:22 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 168858E0002; Fri, 18 Jan 2019 12:54:22 -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 0315F8E001E; Fri, 18 Jan 2019 12:54:21 -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 984568E0002 for ; Fri, 18 Jan 2019 12:54:21 -0500 (EST) Received: by mail-ed1-f71.google.com with SMTP id o21so5274782edq.4 for ; Fri, 18 Jan 2019 09:54:21 -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=1umYCuCqPEt8hgwHsF5GWN8/VBehoTF7sexCPQhQrac=; b=oKA760+P/+WfvXHe081SLHiLhvb9rTEW2x7CQZy/H00A3yWy33bNp2Hrp9nX9MF+U4 rn5pfqxX7XL0Fo4ziNprbhPh9YxQcB28mqb+ilBblL8yF+42db0KrjndjM+kiQj0Yxyz EKtJgp+/yINSIWmjh/Ndy7Pr6+VzAeN+GANWpNNbmcvocIhNXA70A7cEsK1gwDstr0z8 yw7WKgGlf47ShLX4WcPOPFDl2jrI2cFOQiHM5Jm1AqCnZgOJeXH9VNbCRLJC8l8wGbyV pRdD2LI6xPkdtQNC7+fdaWfIIfeaWM1T4WvZdr90nNWJYRen+riRkhKE8mhU945MzwlN B78Q== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.106 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AJcUukdjPd8Hp/N7Ek+2ubrd4qhLJWYQO3B+CiWFm8MUbI0u1jNAQsfj ZsEzMP4lcYb8HgE2PJEut5LrfZju5+eKAtV5XFC0WWSqF4J0RoRVtaoGnIBz4XFkRBICEpKYBgl IAbNdaN6f7SvygkbIPf7UypEXiE+2tweNnWGW08nK38vhq8qCI8Zuym+gZIHbKrkW3A== X-Received: by 2002:a50:c089:: with SMTP id k9mr13045446edf.89.1547834061083; Fri, 18 Jan 2019 09:54:21 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Se6YROrqAEokcSGwmeQF0kAuPDm05P007BQf0MnhXAxxrPgbU45TAUkgWZD6rI1ymcHzp X-Received: by 2002:a50:c089:: with SMTP id k9mr13045380edf.89.1547834060003; Fri, 18 Jan 2019 09:54:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547834060; cv=none; d=google.com; s=arc-20160816; b=lYdorYpvO/M4iXQ3tVMJ9pvNm1hpFGD7Lg7FibGCIPyiCCEb9zOYUFL9Rd7F4O+hi2 FY07imjpjI7qcuxJbCpZaMbwFWsrxuuC7BM9opRbiGMfjfqsqmPmC1kpw3B3aIvUNPY/ Me/REVTgL0ZZjK0BlqWbp3qZKY2cmBm8VETDkfyj9+Uzx88Fp5pvn7Dubi4lmGkZ6VLd FbfMwDvOk+oc4Ww8Rs/m5DG1iHoAlyiipI044+xwU91GXaiEqwzyRnZFVfmvtn/k/ckc fmdPhKBOhBkicBQ1JHPEWaKcSbSM46NAMHKdBWxi+sfw6xiAGhrmsySYlFkbSA3/nWcL weAg== 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=1umYCuCqPEt8hgwHsF5GWN8/VBehoTF7sexCPQhQrac=; b=xtXV2zC7eHwy/5MgmsMpNZY/TtvOfm3cjTvSqYKzaR2MWCucl0v9yfQSoYFjTGlsoI i0tqUkIWlIfijHQkQ8RU7TlvbRbqqJGljCEwB4vXN5W2oZrBWLEGxqP7FEwwbyM4qbkk udyL9R4+zNk5moWMFtJnI7Dvy5M8wjqH3nv72uGgyO9TnjK7tou3jLPNLoP5uML0S9TU RDrLdoaOd/cV6A5XcZTeHNOiNQqVip3V165RfNEik2cdngPV1P+oOxEgjckU2bErp7bu B+mylbBQJpoaMuY3TRls/xcoULsJjP4Kfcyi9TcKp/2H1CS2nhRlsEpTiekTQibH4pce /iKw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.106 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp11.blacknight.com (outbound-smtp11.blacknight.com. [46.22.139.106]) by mx.google.com with ESMTPS id b11si2182035edj.393.2019.01.18.09.54.19 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 18 Jan 2019 09:54:19 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.106 as permitted sender) client-ip=46.22.139.106; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.106 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp11.blacknight.com (Postfix) with ESMTPS id A150C1C3579 for ; Fri, 18 Jan 2019 17:54:19 +0000 (GMT) Received: (qmail 5918 invoked from network); 18 Jan 2019 17:54:19 -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:19 -0000 From: Mel Gorman To: Andrew Morton Cc: David Rientjes , Andrea Arcangeli , Vlastimil Babka , Linux List Kernel Mailing , Linux-MM , Mel Gorman Subject: [PATCH 15/22] mm, compaction: Keep cached migration PFNs synced for unusable pageblocks Date: Fri, 18 Jan 2019 17:51:29 +0000 Message-Id: <20190118175136.31341-16-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 Migrate has separate cached PFNs for ASYNC and SYNC* migration on the basis that some migrations will fail in ASYNC mode. However, if the cached PFNs match at the start of scanning and pageblocks are skipped due to having no isolation candidates, then the sync state does not matter. This patch keeps matching cached PFNs in sync until a pageblock with isolation candidates is found. The actual benefit is marginal given that the sync scanner following the async scanner will often skip a number of pageblocks but it's useless work. Any benefit depends heavily on whether the scanners restarted recently. Signed-off-by: Mel Gorman Acked-by: Vlastimil Babka --- mm/compaction.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 14bb66d48392..829540f6f3da 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1969,6 +1969,7 @@ static enum compact_result compact_zone(struct compact_control *cc) unsigned long end_pfn = zone_end_pfn(cc->zone); unsigned long last_migrated_pfn; const bool sync = cc->mode != MIGRATE_ASYNC; + bool update_cached; cc->migratetype = gfpflags_to_migratetype(cc->gfp_mask); ret = compaction_suitable(cc->zone, cc->order, cc->alloc_flags, @@ -2016,6 +2017,17 @@ static enum compact_result compact_zone(struct compact_control *cc) last_migrated_pfn = 0; + /* + * Migrate has separate cached PFNs for ASYNC and SYNC* migration on + * the basis that some migrations will fail in ASYNC mode. However, + * if the cached PFNs match and pageblocks are skipped due to having + * no isolation candidates, then the sync state does not matter. + * Until a pageblock with isolation candidates is found, keep the + * cached PFNs in sync to avoid revisiting the same blocks. + */ + update_cached = !sync && + cc->zone->compact_cached_migrate_pfn[0] == cc->zone->compact_cached_migrate_pfn[1]; + trace_mm_compaction_begin(start_pfn, cc->migrate_pfn, cc->free_pfn, end_pfn, sync); @@ -2047,6 +2059,11 @@ static enum compact_result compact_zone(struct compact_control *cc) last_migrated_pfn = 0; goto out; case ISOLATE_NONE: + if (update_cached) { + cc->zone->compact_cached_migrate_pfn[1] = + cc->zone->compact_cached_migrate_pfn[0]; + } + /* * We haven't isolated and migrated anything, but * there might still be unflushed migrations from @@ -2054,6 +2071,7 @@ static enum compact_result compact_zone(struct compact_control *cc) */ goto check_drain; case ISOLATE_SUCCESS: + update_cached = false; last_migrated_pfn = start_pfn; ; }