Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp89667imu; Fri, 14 Dec 2018 15:04:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/UgklHiJ01BOgpGz7ko9ezONsVnzMzkq2sKQTTnbATrqsV/u6yGsJnIwuMuGzJUqz8L5o0U X-Received: by 2002:a17:902:29ab:: with SMTP id h40mr4563349plb.238.1544828699694; Fri, 14 Dec 2018 15:04:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544828699; cv=none; d=google.com; s=arc-20160816; b=QuzROw63rB27wsDb3XAbU6hx+A4PSzQPx4qdX68FehzoC6YNSBtKKbl55WQ/iAJ/Ow d77Z6vimgbP5aKFgrgnpzQsIW5o4WtKJLiy32lbu2oA3O1sWRAiPGy9PlHBJI1kH3OkG RJF9NPYAzmFXnMQrzfOaaLldsGXzz4UZ7VxD3lbgwmSJHAtjQQrEk/4++RfQ0eaOqSoc Om41dfcrRsTrdd5ORLQWBi0E0OylzfB5WlQ4w1xazScWd47hmEqoFfECsz81kqbOq6Yi A9TGp9CwFftnSGzbGMELQDjf5XiJAJiALGc8bIllkQ/DWxcZWcwYrFynlbO5ci9fsmP/ QQwQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=W8Lfqfpa4DlGkxutCqLVK1CDgi6G7m2LALKtQM047S4=; b=xcr7RfCD+9EkKcmNguRVWWYjfShbLtsD4pMjiGJ9VN2Ihkn9PSCRmm/0LcyAkU51VB xq1gQ/fshrLtaKmY8kp9PtHbvSt4D7PF62exPo/lcMKXceSWUPOlcYaYvnR20HO0YdEQ 7+bdJH9wSVOV1AeiOI9wiJ0NXDThMTRY+GZ0svbCFbxnwSy93VYR+sv+M8XQ3/2eMUEZ mlU2OBXAkqlJ91T2kq0N7OndPnQ30t/xzT3fozsDdzj5U6wu+4zRChI9iD0ioyruRCJ9 PknSCz3XBYy5mYJe9j12z1hMf0A0p60C9+uHOBwafdUfVV26HfwkkerXnuQ0JbCV4uDT TlLw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d34si2204926pla.80.2018.12.14.15.04.44; Fri, 14 Dec 2018 15:04:59 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730856AbeLNXDe (ORCPT + 99 others); Fri, 14 Dec 2018 18:03:34 -0500 Received: from outbound-smtp12.blacknight.com ([46.22.139.17]:42127 "EHLO outbound-smtp12.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730023AbeLNXDO (ORCPT ); Fri, 14 Dec 2018 18:03:14 -0500 Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp12.blacknight.com (Postfix) with ESMTPS id 8CA061C2081 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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 -- 2.16.4