Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp1416750imm; Thu, 4 Oct 2018 13:18:27 -0700 (PDT) X-Google-Smtp-Source: ACcGV63GLV9DbGXfgEdaHfVF1pApXLAoG5D68WljcVINkGDPRirO9DSAqGaoOskBHB/J6zOJjf3/ X-Received: by 2002:a63:c642:: with SMTP id x2-v6mr6273697pgg.16.1538684306977; Thu, 04 Oct 2018 13:18:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538684306; cv=none; d=google.com; s=arc-20160816; b=ad2nQft0991hGdPjsh49D9hgOBaLd72BJ1mwC5GaLeo8ugwig0iA2i38n4t+bSVHuf akz1/GM697slxffSsjLG4Z+xXYJsPTfaqkfBUmNcdGrXZNu41v6J81QTugCfK8OaoT/Y wKovbMi4vog51oaxsFRcBLhC5flzYh71RFg/uz6U5WR4LSYqznuIJJs9WJ/d0UxVI/H5 TE/eIeyCuKCQpm5mPXnNGYEe8zFiNPK2JTAqa9bj658hMd0GEzRXSHehxlOrVnINGS4S ekuzXvTPoY/wvJ7dhy3TycywRiZIyUyQHyNq3LIrh147gfqw7t4hn/DDNrYWtaQUeBgW oLDg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date:dkim-signature; bh=DRWXQwbaliKlq4Q4fGXtjROvaifpiIon+ksWJndx7Hc=; b=lNSOPRD+Pc5R7DmN/g9b8Efa3OiilLhO35akoVzrvofUjavazTpu1Jq1cdEkpsm1eQ BZc/9IDWcR2IxZP/S4bgJcOZCLx8ciIjfEEca2GiuhCNw78gzq7xEtOpEISzbBHJ1YYb FBcozfgDMIVjdCwwgX+pKylC0gu4UwMAj/SdqoFJ7VzcROy1ipYR+iveNXRcIM8A1CzR adFnqnILsAia+jl0gCQkqRktlmWDVxd3TUXHSIS+WPvz9NvpufMWMhY4mnGSpjsBhSh1 EeHKdgWjTEU6wqpo0W3c10Xby5mLyvxQq3VyUmwUw2C6NbY4wSCZzZ0rfqL/0KbMt463 a0Ew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Z5ie3ZtM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c31-v6si5590049pgb.348.2018.10.04.13.18.11; Thu, 04 Oct 2018 13:18:26 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=Z5ie3ZtM; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727998AbeJEDMp (ORCPT + 99 others); Thu, 4 Oct 2018 23:12:45 -0400 Received: from mail-pl1-f196.google.com ([209.85.214.196]:35284 "EHLO mail-pl1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727354AbeJEDMp (ORCPT ); Thu, 4 Oct 2018 23:12:45 -0400 Received: by mail-pl1-f196.google.com with SMTP id f8-v6so5713224plb.2 for ; Thu, 04 Oct 2018 13:17:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:from:to:cc:subject:in-reply-to:message-id:references :user-agent:mime-version; bh=DRWXQwbaliKlq4Q4fGXtjROvaifpiIon+ksWJndx7Hc=; b=Z5ie3ZtMW/PzE7ePnAM4IPViOYJ1DzOH+xV4LjejwL2ufXtSedDcMRTSSFZtNE5+Pu KXDPMRZ6+DugonrTdHBPkwKJf2O2ChfVsX46Fyce2smenyyfEgRq91wn8mgaPE3kYay4 PSX9exyu52nGNA1VXbCK5jPDNr66VdzPdPFHOGQKNXBmgTcw/FyatDCP574HFX/scE1O X8xFH8RdBsLkpc1NBE5wxBV/vH9m0P8Qi03K0YySS55BXfnlgr3KahK9Ai+bkq6/fGvx DsSHHZrMOyqscSPWbV2VQMjSM04lYjCKBslk3zeOe4U75qxLAhHX81EpnFzi/zHey3bc DiCA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:in-reply-to:message-id :references:user-agent:mime-version; bh=DRWXQwbaliKlq4Q4fGXtjROvaifpiIon+ksWJndx7Hc=; b=EiDG2kvBGU2uNafE/eGuSsgOlbJhfDwdx2MWREuJUYHTJcPhMzfx+1ETRcvD57wfNN lwCS1WK19L2YngL0RhSPHT/jfYrxt9Qe+1VoLad9sa/acyeLwubgtBWzjvXPZDahGCxD 4fbi88bwApZEpytcfK2BAx7houLj9NZtAu07nKFXAq2U4hYcX8YdtZ/U9dZzJ7SYUloW 2ncH6CACl5f/koqXPwwv7yxCTYNHLhLEKjCJ9SjS1LFLUhJiOFzsdQC3B+bTLsYbJVRs +RE0577lJLywE/6q2BfdyS/Ei+ki5KJfh+wwa0RRbhYcPG0kl5OrZmr3rPQVOWYfwAPS /dRA== X-Gm-Message-State: ABuFfojGh4JvWf+018OcmAOsGCRRSsb20nkp0R8yQ9nX2KbhKfTRv9yb MzfdiTyqHM0icmn7tx+KFJj9tQ== X-Received: by 2002:a17:902:292a:: with SMTP id g39-v6mr8196873plb.269.1538684273724; Thu, 04 Oct 2018 13:17:53 -0700 (PDT) Received: from [2620:15c:17:3:3a5:23a7:5e32:4598] ([2620:15c:17:3:3a5:23a7:5e32:4598]) by smtp.gmail.com with ESMTPSA id s78-v6sm21317260pfd.138.2018.10.04.13.17.52 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 04 Oct 2018 13:17:52 -0700 (PDT) Date: Thu, 4 Oct 2018 13:17:52 -0700 (PDT) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: "Kirill A. Shutemov" cc: Michal Hocko , Andrew Morton , Mel Gorman , Vlastimil Babka , Andrea Argangeli , Zi Yan , Stefan Priebe - Profihost AG , linux-mm@kvack.org, LKML , Michal Hocko Subject: Re: [PATCH 2/2] mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask In-Reply-To: <20180926133039.y7o5x4nafovxzh2s@kshutemo-mobl1> Message-ID: References: <20180925120326.24392-1-mhocko@kernel.org> <20180925120326.24392-3-mhocko@kernel.org> <20180926133039.y7o5x4nafovxzh2s@kshutemo-mobl1> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 26 Sep 2018, Kirill A. Shutemov wrote: > On Tue, Sep 25, 2018 at 02:03:26PM +0200, Michal Hocko wrote: > > diff --git a/mm/huge_memory.c b/mm/huge_memory.c > > index c3bc7e9c9a2a..c0bcede31930 100644 > > --- a/mm/huge_memory.c > > +++ b/mm/huge_memory.c > > @@ -629,21 +629,40 @@ static vm_fault_t __do_huge_pmd_anonymous_page(struct vm_fault *vmf, > > * available > > * never: never stall for any thp allocation > > */ > > -static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma) > > +static inline gfp_t alloc_hugepage_direct_gfpmask(struct vm_area_struct *vma, unsigned long addr) > > { > > const bool vma_madvised = !!(vma->vm_flags & VM_HUGEPAGE); > > + gfp_t this_node = 0; > > + > > +#ifdef CONFIG_NUMA > > + struct mempolicy *pol; > > + /* > > + * __GFP_THISNODE is used only when __GFP_DIRECT_RECLAIM is not > > + * specified, to express a general desire to stay on the current > > + * node for optimistic allocation attempts. If the defrag mode > > + * and/or madvise hint requires the direct reclaim then we prefer > > + * to fallback to other node rather than node reclaim because that > > + * can lead to excessive reclaim even though there is free memory > > + * on other nodes. We expect that NUMA preferences are specified > > + * by memory policies. > > + */ > > + pol = get_vma_policy(vma, addr); > > + if (pol->mode != MPOL_BIND) > > + this_node = __GFP_THISNODE; > > + mpol_cond_put(pol); > > +#endif > > I'm not very good with NUMA policies. Could you explain in more details how > the code above is equivalent to the code below? > It breaks mbind() because new_page() is now using numa_node_id() to allocate migration targets for instead of using the mempolicy. I'm not sure that this patch was tested for mbind().