Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp196350imm; Tue, 9 Oct 2018 16:23:18 -0700 (PDT) X-Google-Smtp-Source: ACcGV61hk/507p9TdB8HYzGynPBLFgDt8bOr59xVAUjlPPBWWTOjk705SngwyXfK2sCLRiwoCA+j X-Received: by 2002:a63:24f:: with SMTP id 76-v6mr27016998pgc.67.1539127398136; Tue, 09 Oct 2018 16:23:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1539127398; cv=none; d=google.com; s=arc-20160816; b=X6md7S0xpfA3Gq4b24g15z1RYRrQ5V8cMTuxDhawlmcKgaxovcR3vXR7Gelg5wIBOY 2Y8vuQZ9deLy7WtWYFcysnjk4NZw2i4QFHoHhVAgbQSlwjYeBSd3GYgSySyYzJ9Cxc+d Y4Oi/54wECIvW6BVGlKpucWpfojmcSSfzpcrGHatSaQq88NZr6dIZpP5r4cVdOMQEU3O mXGsxhnB0Z+jWB8Qlv+9Ie7qN9ACHB2kzltcWM/At2jGgv9MX3uqKVGcKyV9h2Z6Djo8 tbyAokMV0lml7t+aB6w/VME1Fe+1gXczpm9UKCoBt0C83Wu4lZV8WEbO7TgtcYgejSXX AXQg== 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=QnJqdSokqgAKVbIXHx2VK066+yS2VZW/EpUXuV8bIk0=; b=RoMCoBxbYq+WytT27PKUvnCCis8OWhixMfD7VutsR9A2Iq9ODvG+ja/ZhYqlzujnTk DDhisHbNDowemAOu5RGll15qp/1svbT/bNY3Yzz1X9RmTwAACJ908cZV4afHGwzVqrmq hs+8Y7U3mIRyJmGMPV7K52xwYt464vBOcaOjWIeU67kEw2PAneHprtECpg1AnPv13QDT mdVrZMyR1DHLWIYXoJ0SctfOUNziAtvbcooTSiS3T7CQoAOhWuSd1d7jehhxC1l7J2pL CQV0S7hGc1lmnPCk7d/z9BQYmD7bsfPtNjCCJ3i2jyuL7BLQXRpV/SQmKLPukmqjiDmw PbGQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b11-v6si25318992plk.302.2018.10.09.16.23.01; Tue, 09 Oct 2018 16:23:18 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbeJJGXI (ORCPT + 99 others); Wed, 10 Oct 2018 02:23:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:46374 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725827AbeJJGXI (ORCPT ); Wed, 10 Oct 2018 02:23:08 -0400 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E14D2307D861; Tue, 9 Oct 2018 23:03:53 +0000 (UTC) Received: from sky.random (ovpn-120-22.rdu2.redhat.com [10.10.120.22]) by smtp.corp.redhat.com (Postfix) with ESMTPS id AD2F27C81E; Tue, 9 Oct 2018 23:03:53 +0000 (UTC) Date: Tue, 9 Oct 2018 19:03:52 -0400 From: Andrea Arcangeli To: Michal Hocko Cc: Mel Gorman , David Rientjes , Andrew Morton , Vlastimil Babka , Andrea Argangeli , Zi Yan , Stefan Priebe - Profihost AG , "Kirill A. Shutemov" , linux-mm@kvack.org, LKML , Stable tree Subject: Re: [PATCH 1/2] mm: thp: relax __GFP_THISNODE for MADV_HUGEPAGE mappings Message-ID: <20181009230352.GE9307@redhat.com> References: <20180925120326.24392-2-mhocko@kernel.org> <20181005073854.GB6931@suse.de> <20181005232155.GA2298@redhat.com> <20181009094825.GC6931@suse.de> <20181009122745.GN8528@dhcp22.suse.cz> <20181009130034.GD6931@suse.de> <20181009142510.GU8528@dhcp22.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181009142510.GU8528@dhcp22.suse.cz> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Tue, 09 Oct 2018 23:03:54 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 09, 2018 at 04:25:10PM +0200, Michal Hocko wrote: > On Tue 09-10-18 14:00:34, Mel Gorman wrote: > > On Tue, Oct 09, 2018 at 02:27:45PM +0200, Michal Hocko wrote: > > > [Sorry for being slow in responding but I was mostly offline last few > > > days] > > > > > > On Tue 09-10-18 10:48:25, Mel Gorman wrote: > > > [...] > > > > This goes back to my point that the MADV_HUGEPAGE hint should not make > > > > promises about locality and that introducing MADV_LOCAL for specialised > > > > libraries may be more appropriate with the initial semantic being how it > > > > treats MADV_HUGEPAGE regions. > > > > > > I agree with your other points and not going to repeat them. I am not > > > sure madvise s the best API for the purpose though. We are talking about > > > memory policy here and there is an existing api for that so I would > > > _prefer_ to reuse it for this purpose. > > > > > > > I flip-flopped on that one in my head multiple times on the basis of > > how strict it should be. Memory policies tend to be black or white -- > > bind here, interleave there, etc. It wasn't clear to me what the best > > policy would be to describe "allocate local as best as you can but allow > > fallbacks if necessary". MPOL_PREFERRED is not black and white. In fact I asked David earlier if MPOL_PREFERRED could check if it would already be a good fit for this. Still the point is it requires privilege (and for a good reason). > I was thinking about MPOL_NODE_PROXIMITY with the following semantic: > - try hard to allocate from a local or very close numa node(s) even when > that requires expensive operations like the memory reclaim/compaction > before falling back to other more distant numa nodes. If MPOL_PREFERRED can't work something like this could be added. I think "madvise vs mbind" is more an issue of "no-permission vs permission" required. And if the processes ends up swapping out all other process with their memory already allocated in the node, I think some permission is correct to be required, in which case an mbind looks a better fit. MPOL_PREFERRED also looks a first candidate for investigation as it's already not black and white and allows spillover and may already do the right thing in fact if set on top of MADV_HUGEPAGE. Thanks, Andrea