From patchwork Fri Jan 4 12:50:11 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10748349 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 A2F7C1575 for ; Fri, 4 Jan 2019 12:54:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 943312847E for ; Fri, 4 Jan 2019 12:54:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 88CB228481; Fri, 4 Jan 2019 12:54:40 +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 2A8B428488 for ; Fri, 4 Jan 2019 12:54:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D14F8E00EB; Fri, 4 Jan 2019 07:54:39 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 380B38E00AE; Fri, 4 Jan 2019 07:54:39 -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 270D08E00EB; Fri, 4 Jan 2019 07:54:39 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by kanga.kvack.org (Postfix) with ESMTP id BA91E8E00AE for ; Fri, 4 Jan 2019 07:54:38 -0500 (EST) Received: by mail-ed1-f70.google.com with SMTP id t2so34862056edb.22 for ; Fri, 04 Jan 2019 04:54:38 -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=bdIUtOAOt9coFkqKltJJ1JNZAbLhv6qY/uLZwv5FejQ=; b=L+nNzqV4JI5SUnY3IflpBsbRau+cOJdN8EqeXFKthDk0K7fk7/Uu09MHwKiiewuWz/ 2zwRQybZDVZ6ifomyGMbAEtIgo6s0aUjgBzz6htRWPywkWtS2W/ethRRVucXeNaVjxK9 HPPpKlKK+nHylpki4pC6GgCG4v2imwTje6MG0Vxg6BaCMfdLL2Cju9MF46fhsukGiGLd z9vYNyw21m7AMlumoml7dQa7TSbPhLc2qN33d6eKBYHu8K+QBAiEXRVyZcRbrNNZE0Y5 JQNakaETVr7lBHo25saERty6rQYeh3GnU5xbskKFs8yf155NsmP7zqBHq31yH0ocV4LI vmJg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.230 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWZZM65emyUb2CB6bJN7k8Jh0x7GbpeFovmLSxETARGLFysI/CNU hSdEvLYLcRX1aGzoDhf2d9EPOn7sl8HkBsIKEGNCuMba9L636+Ew4sxDFstj7jzcRx1GlZN3UoT OVBAMDk9xqZ+vTsqF0W5GcnW9FiCoXb5mQVfbeMtoS7MfI6EZse7IpdGyP8uqtvfbEQ== X-Received: by 2002:a50:ee1a:: with SMTP id g26mr45332536eds.266.1546606478264; Fri, 04 Jan 2019 04:54:38 -0800 (PST) X-Google-Smtp-Source: AFSGD/UtN6GzvQhAjcuXza8mAoQvsiGkQQqJWhyebHz2INGy+F7t1fOpTvRG2mAs4m9uTKU+28Co X-Received: by 2002:a50:ee1a:: with SMTP id g26mr45332501eds.266.1546606477386; Fri, 04 Jan 2019 04:54:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1546606477; cv=none; d=google.com; s=arc-20160816; b=za8PCZE+sliIYzqQ8KjNLTh4BEuiGqOrE9TxQpXTLJAoS89IibhDeO5NbnwKEVNq3w FdKx1tAY0Byb7NviBshEm6N0LhLfD0I106eSnIZwzFa04R/hE9mIoJdWvR/ZfxCWNhZu +wJdWBPUgoclTyBdtXvvJgevQEE8EdYBh00rL5wT1PzXHNDqzQN0VRISsyT4AVDj1iwE Y0vNbhUF6tK58SJ1kZQq6PV13fD62LXzZJNApbP5f4BS0cnNXbfDnqGa9n8S9Wc2LPeY 9QrlNuhm83xOX7gdhSLqG4Xa2NIBo35oTEH5TvqqWnJbe+A37uS0lbQqWHNA7LxMojxd uwxA== 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=bdIUtOAOt9coFkqKltJJ1JNZAbLhv6qY/uLZwv5FejQ=; b=ZuYVS2TTxZVMPikkDdJfzrFEOZrtmerD6PvgdCz2huuUhse3kdKqoWdG9rt7QWVWf5 cKQodLo1cmn3xACcXffKLiqJZfogArImopKE+lIzh+pkbxatm2U1Ilui2HPtd05xllMH ctL7GGbI2NpKrBXPVyAR0UjWhHl2ceZzLop0WgedvbD2SOjcUIZryQba7Xkzv4pd7wfY dAZyQtKGr6kBDLfrANOSVb2HYA1tQIgDY2f6UjK5LqGvqeT2ifoqYW28AuEuswRIbKsA yUqg68RtauxAAeDBAmURmdkcQLIjy8HNfqDM0lFyqxYPUMP37Conb+ANdivZq1/Hrvyk QpPw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.230 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp13.blacknight.com (outbound-smtp13.blacknight.com. [46.22.139.230]) by mx.google.com with ESMTPS id l1si937018edc.252.2019.01.04.04.54.37 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 04 Jan 2019 04:54:37 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.230 as permitted sender) client-ip=46.22.139.230; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.230 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (unknown [81.17.254.16]) by outbound-smtp13.blacknight.com (Postfix) with ESMTPS id 0A7B71C1C22 for ; Fri, 4 Jan 2019 12:54:37 +0000 (GMT) Received: (qmail 12608 invoked from network); 4 Jan 2019 12:54:36 -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:54:36 -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 25/25] mm, compaction: Do not direct compact remote memory Date: Fri, 4 Jan 2019 12:50:11 +0000 Message-Id: <20190104125011.16071-26-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 Remote compaction is expensive and possibly counter-productive. Locality is expected to often have better performance characteristics than remote high-order pages. For small allocations, it's expected that locality is generally required or fallbacks are possible. For larger allocations such as THP, they are forbidden at the time of writing but if __GFP_THISNODE is ever removed, then it would still be preferable to fallback to small local base pages over remote THP in the general case. kcompactd is still woken via kswapd so compaction happens eventually. While this patch potentially has both positive and negative effects, it is best to avoid the possibility of remote compaction given the cost relative to any potential benefit. Signed-off-by: Mel Gorman --- mm/compaction.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index ae70be023b21..cc17f0c01811 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2348,6 +2348,16 @@ enum compact_result try_to_compact_pages(gfp_t gfp_mask, unsigned int order, continue; } + /* + * Do not compact remote memory. It's expensive and high-order + * small allocations are expected to prefer or require local + * memory. Similarly, larger requests such as THP can fallback + * to base pages in preference to remote huge pages if + * __GFP_THISNODE is not specified + */ + if (zone_to_nid(zone) != zone_to_nid(ac->preferred_zoneref->zone)) + continue; + status = compact_zone_order(zone, order, gfp_mask, prio, alloc_flags, ac_classzone_idx(ac), capture); rc = max(status, rc);