Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp347299ybi; Fri, 31 May 2019 02:25:17 -0700 (PDT) X-Google-Smtp-Source: APXvYqwsT2DMliy3nfU62ABr7JMXy6Eq3Z++8xz1JA4vkUUmTYPxjr6Vlng+aLOGS3dhVDGlaR7q X-Received: by 2002:a17:902:7089:: with SMTP id z9mr8114533plk.335.1559294716931; Fri, 31 May 2019 02:25:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559294716; cv=none; d=google.com; s=arc-20160816; b=cYSCbi9JlOmbD5Jg2rkp6N0sPr2QUlJjWwWIepzYMWYzacYpQAtxafWXx4C+3IZCm/ hw1821nt2ldq8gqW9RiWJz3XwjZKD6pdDt+Nu3psczw5WMgGmjtCwiidMvSk8CuBMIyF jSGx7XWzVUGsL0lQNP4l8Ra528ARqaIKrzx+dODKWzbEZIlBOZZBGqGcFiCkDlYr/rdD +Ii1dfkCTfxDX1t05AFQLkk4nGkoN09LK4HtMAdl4AUE6rxGAwqFDjrl+LFRZTZtT6Zo GxCWQyj56HTy1rXyHDgxohCJM3dFDLP+0Wlz3B5QthXLV9ZGD5r4ml2UzWpkimccOvvN bBuQ== 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=AjUc2JjgHkJQyA4ngFyP96HTgVuQBQGRJBQ3Re4x6EQ=; b=0t9YmYT9uK8e5r3cKxLZOcLLQnb22xCSpdTDCZ+2MXfODTSN0UXHTJ4zVJhdmvS/An HhegAQ7PPSgyJGA0/ZldGSjG7m3DgMkogXADHmjwW5/D8X35xqZiS926J5a5WlDpWPvF yx+aiBwSFXRbvqeAsgd8rQzT265icraGVDA9T70y6NyQuI+VOcLK05e3KQ9gUCpfgWhB 82om6bqTZlPVaxEuzEEG/P4V3bk39VIbx3xz+4e/BaE7WAxN9hnC8Mmy8CyPZlslkEck aWl+Q4ibaiwD+jY/Hhxcgobz6S8U99dwGIPTuk74CI+ytQrpVxeoNU4UtsdGJBejj0IH 7MnA== 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 y1si540639plk.374.2019.05.31.02.25.00; Fri, 31 May 2019 02:25:16 -0700 (PDT) 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 S1727133AbfEaJWj (ORCPT + 99 others); Fri, 31 May 2019 05:22:39 -0400 Received: from mx2.suse.de ([195.135.220.15]:60254 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726158AbfEaJWj (ORCPT ); Fri, 31 May 2019 05:22:39 -0400 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 23EC6AFD2; Fri, 31 May 2019 09:22:37 +0000 (UTC) Date: Fri, 31 May 2019 11:22:36 +0200 From: Michal Hocko To: David Rientjes Cc: Andrew Morton , Mel Gorman , Andrea Arcangeli , Vlastimil Babka , Zi Yan , Stefan Priebe - Profihost AG , "Kirill A. Shutemov" , linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 2/2] Revert "mm, thp: restore node-local hugepage allocations" Message-ID: <20190531092236.GM6896@dhcp22.suse.cz> References: <20190503223146.2312-1-aarcange@redhat.com> <20190503223146.2312-3-aarcange@redhat.com> <20190520153621.GL18914@techsingularity.net> <20190523175737.2fb5b997df85b5d117092b5b@linux-foundation.org> 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 29-05-19 14:24:33, David Rientjes wrote: > On Thu, 23 May 2019, Andrew Morton wrote: > > > > We are going in circles, *yes* there is a problem for potential swap > > > storms today because of the poor interaction between memory compaction and > > > directed reclaim but this is a result of a poor API that does not allow > > > userspace to specify that its workload really will span multiple sockets > > > so faulting remotely is the best course of action. The fix is not to > > > cause regressions for others who have implemented a userspace stack that > > > is based on the past 3+ years of long standing behavior or for specialized > > > workloads where it is known that it spans multiple sockets so we want some > > > kind of different behavior. We need to provide a clear and stable API to > > > define these terms for the page allocator that is independent of any > > > global setting of thp enabled, defrag, zone_reclaim_mode, etc. It's > > > workload dependent. > > > > um, who is going to do this work? > > > > Implementing a new API doesn't help existing userspace which is hurting > > from the problem which this patch addresses. > > > > The problem which this patch addresses has apparently gone unreported for > 4+ years since Can we finaly stop considering the time and focus on the what is the most reasonable behavior in general case please? Conserving mistakes based on an argument that we have them for many years is just not productive. It is very well possible that workloads that suffer from this simply run on older distribution kernels which are moving towards newer kernels very slowly. > commit 077fcf116c8c2bd7ee9487b645aa3b50368db7e1 > Author: Aneesh Kumar K.V > Date: Wed Feb 11 15:27:12 2015 -0800 > > mm/thp: allocate transparent hugepages on local node Let me quote the commit message to the full lenght " This make sure that we try to allocate hugepages from local node if allowed by mempolicy. If we can't, we fallback to small page allocation based on mempolicy. This is based on the observation that allocating pages on local node is more beneficial than allocating hugepages on remote node. With this patch applied we may find transparent huge page allocation failures if the current node doesn't have enough freee hugepages. Before this patch such failures result in us retrying the allocation on other nodes in the numa node mask. " I do not see any single numbers backing those claims or any mention of a workload that would benefit from the change. Besides that, we have seen that THP on a remote (but close) node might be performing better per Andrea's numbers. So those claims do not apply in general. This is a general problem when making decisions on heuristics which are not a clear cut. AFAICS there have been pretty good argments given that _real_ workloads suffer from this change while a demonstration of a _real_ workload that is benefiting is still missing. > My goal is to reach a solution that does not cause anybody to incur > performance penalties as a result of it. That is certainly appreciated and I can offer my help there as well. But I believe we should start with a code base that cannot generate a swapping storm by a trivial code as demonstrated by Mel. A general idea on how to approve the situation has been already outlined for a default case and a new memory policy has been mentioned as well but we need something to start with and neither of the two is compatible with the __GFP_THISNODE behavior. [...] > The easiest solution would be to define the MADV_HUGEPAGE behavior > explicitly in sysfs: local or remote. Defaut to local as the behavior > from the past four years and allow users to specify remote if their > workloads will span multiple sockets. This is somewhat coarse but no more > than the thp defrag setting in sysfs today that defines defrag behavior > for everybody on the system. This just makes the THP tunning even muddier. Really, can we start with a code that doesn't blow up trivially and build on top? In other words start with a less specialized usecase being covered and help more specialized usecases to get what they need. -- Michal Hocko SUSE Labs