Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10460513imu; Thu, 6 Dec 2018 01:15:10 -0800 (PST) X-Google-Smtp-Source: AFSGD/Wn+OAc80IvK0rZnXGc/NtRWfx4Of9CGsOg/M5XUnGX+P+lxvudrFVWbDRCZYWH+dCT7EQP X-Received: by 2002:a63:dd15:: with SMTP id t21mr22587499pgg.347.1544087710136; Thu, 06 Dec 2018 01:15:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544087710; cv=none; d=google.com; s=arc-20160816; b=TC8h058+4YQPnpiDtrj8F1tbSw3CcxzgRxSlDfk4rgzuk1MUMs+HyjEzkn2RT4TH23 ilWZRrTZZKZS9a8DlI3XttraUMRhJuOIWsEJJRoWY7MgJV5zxU7+ICaat/jLKFc1kem2 nWJDJh9tACrgoQ1+UoVpUMzmDwfSV5MiC11oN+WghWFSoGJyVFmbSt8bGrYU6Hv6AJTO k8/H+dB2MR3iYL3MwUCrtJBo0aDE+G3Yr1W9l+DHBtU+QUIVAtcuk9A1z//5NJOJydGh DRMmtZfRW7FpAvXjIC0Aeij/VY/wtsNC97x1WZAhC07W61tI5oPpfdnxUfblGBsz09Hq GtYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=OiYC/RGNiUmnoEN/Mqb7JAONMReEujJk/Boveoug1Ok=; b=Ewe8YM3p+oRTU4Ht1DV8gOukE1tEuxqseK5/VHPAHLV6mE/Mk9n7OF+yrSmRoNth32 0BgZy39ycOfREMTYBya01bM6iaBLqR1RI/66MmH+tav8Z7FBtev1OvomoHZp7/1NJVrV 631afIPF42VHaNsMq19FaauT6gEddV69zRCK5bnfFST5ZIwW9f9cSvlI6eKMfosDOj4Z w8YT1Zmz25NYAPRveVBbkSI3qNlpnvmUFTACKQ1sxmlhpj09cxCj064oYhp3/dZff0v7 sV32ffjjzNGqsTBJjEaO1SCgD5g6xwtxnUPoS4mqTB+c1wxpouKCJx0xGtkWTD5Sz/7E Xj7g== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j186si5318986pfb.35.2018.12.06.01.14.53; Thu, 06 Dec 2018 01:15:10 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729320AbeLFJOL (ORCPT + 99 others); Thu, 6 Dec 2018 04:14:11 -0500 Received: from mx2.suse.de ([195.135.220.15]:52524 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727763AbeLFJOK (ORCPT ); Thu, 6 Dec 2018 04:14:10 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 7CF61AE85; Thu, 6 Dec 2018 09:14:08 +0000 (UTC) Date: Thu, 6 Dec 2018 10:14:06 +0100 From: Michal Hocko To: Linus Torvalds Cc: Andrea Arcangeli , mgorman@techsingularity.net, Vlastimil Babka , ying.huang@intel.com, s.priebe@profihost.ag, Linux List Kernel Mailing , alex.williamson@redhat.com, lkp@01.org, David Rientjes , kirill@shutemov.name, Andrew Morton , zi.yan@cs.rutgers.edu Subject: MADV_HUGEPAGE vs. NUMA semantic (was: Re: [LKP] [mm] ac5b2c1891: vm-scalability.throughput -61.3% regression) Message-ID: <20181206091405.GD1286@dhcp22.suse.cz> References: <20181203201214.GB3540@redhat.com> <64a4aec6-3275-a716-8345-f021f6186d9b@suse.cz> <20181204104558.GV23260@techsingularity.net> <20181205204034.GB11899@redhat.com> <20181205233632.GE11899@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed 05-12-18 16:58:02, Linus Torvalds wrote: [...] > I realize that we probably do want to just have explicit policies that > do not exist right now, but what are (a) sane defaults, and (b) sane > policies? I would focus on the current default first (which is defrag=madvise). This means that we only try the cheapest possible THP without MADV_HUGEPAGE. If there is none we simply fallback. We do restrict to the local node. I guess there is a general agreement that this is a sane default. MADV_HUGEPAGE changes the picture because the caller expressed a need for THP and is willing to go extra mile to get it. That involves allocation latency and as of now also a potential remote access. We do not have complete agreement on the later but the prevailing argument is that any strong NUMA locality is just reinventing node-reclaim story again or makes THP success rate down the toilet (to quote Mel). I agree that we do not want to fallback to a remote node overeagerly. I believe that something like the below would be sensible 1) THP on a local node with compaction not giving up too early 2) THP on a remote node in NOWAIT mode - so no direct compaction/reclaim (trigger kswapd/kcompactd only for defrag=defer+madvise) 3) fallback to the base page allocation This would allow both full memory utilization and try to be as local as possible. Whoever strongly prefers NUMA locality should be using MPOL_NODE_RECLAIM (or similar) and that would skip 2 and make 1) and 2) use more aggressive compaction and reclaim. This will also fit into our existing NUMA api. MPOL_NODE_RECLAIM wouldn't be restricted to THP obviously. It would act on base pages as well and it would basically use the same implementation as we have for the global node_reclaim and make it usable again. Does this sound at least remotely sane? -- Michal Hocko SUSE Labs