From patchwork Fri Dec 14 23:06:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mel Gorman X-Patchwork-Id: 10731797 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 927FF1399 for ; Fri, 14 Dec 2018 23:06:06 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F74E2D653 for ; Fri, 14 Dec 2018 23:06:06 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 31A832D666; Fri, 14 Dec 2018 23:06:06 +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 B9E3D2D653 for ; Fri, 14 Dec 2018 23:06:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id ECA1E8E0224; Fri, 14 Dec 2018 18:06:04 -0500 (EST) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id E78068E021D; Fri, 14 Dec 2018 18:06:04 -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 D41C58E0224; Fri, 14 Dec 2018 18:06:04 -0500 (EST) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) by kanga.kvack.org (Postfix) with ESMTP id 7F1F38E021D for ; Fri, 14 Dec 2018 18:06:04 -0500 (EST) Received: by mail-ed1-f72.google.com with SMTP id c18so3352390edt.23 for ; Fri, 14 Dec 2018 15:06:04 -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:date:from:to :cc:subject:message-id:references:mime-version:content-disposition :in-reply-to:user-agent; bh=trAgTToOUXQrMMJDw26L4N1jLTSPWeCf0bP1DLO9Oh0=; b=DNJkZ9jb6FgjfSeqYQR197KfbQRSXWLfvhDHHRYu6BNRdBNe4b+1GYA0bXaW0M5Ksg TeSPc5B10+WT4QwJyuGa18I71VuiEONm7XPoYDMRwU5K1R+xjzUd7jC94JsfNmvp1DHs +aWhlwtAUamLjCJCGZkikfbqY+fgeOmag4DCqVcuQ1cee75692zIUUJk1PSyqwvhy2jo lmlNfOYyk6oV8G28LuGcBefIrER2x2tC+sGiT9pTHKKZKGhwu+YNxykrRSTqBj2CKNw5 yQC2pt7GUAG1MDAJmcCeKeOQKmZWc7DgcLPCF8BTGBOw+vTNM74aGiPK3PAJ97qJtcFA CdMg== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net X-Gm-Message-State: AA+aEWbB6JSppw2uRUjAq97/bF1RxOQXsN+yGY0Vownho8sceTPYz2yQ XmWBp7GWZfg0z7AdGYufcpDTOV+/59nmChvdTyzFgvfbqfsaFy6rG94bBJG8KcCuV4jjpu4Pyyx AsTBZDG9h0VB8BMwFqor3hMaZ8odslvuSXvPWZ0FIxP7ymbR5v/mVuXE6mWJ3lWuG0w== X-Received: by 2002:a50:a826:: with SMTP id j35mr4668216edc.230.1544828764034; Fri, 14 Dec 2018 15:06:04 -0800 (PST) X-Google-Smtp-Source: AFSGD/XgyXtbML6xN/afw1f4VaHjGlDB79AYR6Or3VIWO/e9E3lE9/Zpvmhx/Rv2jhSK2gD/y75X X-Received: by 2002:a50:a826:: with SMTP id j35mr4668197edc.230.1544828763195; Fri, 14 Dec 2018 15:06:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544828763; cv=none; d=google.com; s=arc-20160816; b=SGIw2HqkyqkFJRKaRSawDAIUCAMO+2jfNOKejkMpqk9VcL71St3l9JyswRv3CowZwS 12bRkmE2Mg+BdgRTLcjueFNPuPE5MNJ931rLemEEc+8Qhsq0wZpOJZ1O/AYnGglVtC58 LAU0ArY4KVGeVAWLDhvuGxN2A3lp0rsrnJTqd+3DslRsEwQJ7F3QcB8OWPbHpUGL4F5J +UoV183o2YeWYVObsMSYWxOsEx5KIAXRIIrSy0OHJ/2G/g5w0WHgUiQ9GX1rH8uvnJff ctRnQPgbS4SAix//1WrDvcBsmijEDrSkMSG6WF5CJ6g8GIBarLrbi/0taIL19XGAxAjJ xrpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date; bh=trAgTToOUXQrMMJDw26L4N1jLTSPWeCf0bP1DLO9Oh0=; b=PjTncBHzoHg4sWq/e5fW60qYoS4K/1uAi0BVU/ffuXpOjUlQzJvoqmkSM8M59CgyBm CQH8NHq3+eNLAefWzYy8DWc2n1vUtXzq43QoFXwvixggPd+iOcyLMdwBUEMpWGVvwwZ4 f/x7T+C/W64rChuG5QnZqdrxUEolqHAKEZvUiViEg9Al+Y50mDCfW+5DhR405N5GgzyS 8G8xSf9FhKBxpoeC8+oUat6dwZTXmuZwTkBhCLEDgDeUKkyzJ1cU5gDyopIonjKholpF 9Eeacxvf4NkV+XuEBGLUra7eb3gySAFn5l3cWZUWKQWBdIvHoa2PDdCGds0RrgPq4vrc 5pdw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from outbound-smtp10.blacknight.com (outbound-smtp10.blacknight.com. [46.22.139.15]) by mx.google.com with ESMTPS id l22si1221132edj.93.2018.12.14.15.06.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 14 Dec 2018 15:06:03 -0800 (PST) Received-SPF: pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) client-ip=46.22.139.15; Authentication-Results: mx.google.com; spf=pass (google.com: domain of mgorman@techsingularity.net designates 46.22.139.15 as permitted sender) smtp.mailfrom=mgorman@techsingularity.net Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp10.blacknight.com (Postfix) with ESMTPS id D19B71C1DFE for ; Fri, 14 Dec 2018 23:06:02 +0000 (GMT) Received: (qmail 3420 invoked from network); 14 Dec 2018 23:06:02 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[37.228.245.71]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 14 Dec 2018 23:06:02 -0000 Date: Fri, 14 Dec 2018 23:06:01 +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 Subject: [PATCH 14/14] mm, compaction: Do not direct compact remote memory Message-ID: <20181214230601.GE29005@techsingularity.net> References: <20181214230310.572-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20181214230310.572-1-mgorman@techsingularity.net> User-Agent: Mutt/1.10.1 (2018-07-13) 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. 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 39d33b6d1172..05fecd7227e4 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2208,6 +2208,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);