Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp1109502imu; Fri, 7 Dec 2018 14:28:15 -0800 (PST) X-Google-Smtp-Source: AFSGD/WiG8BFN2vFraZltXEjz0xmcd5pbnt/cCR5h0xLjWbFv+cNaiyVEwydmnoM1PAjG+YZ+tR8 X-Received: by 2002:a63:66c6:: with SMTP id a189mr3518669pgc.167.1544221695824; Fri, 07 Dec 2018 14:28:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544221695; cv=none; d=google.com; s=arc-20160816; b=MSqpIb6EBrw8jXkqHfKKRODjHOTpwASz/jyks16DV6uhjvuCXMMgeB+jbBBvuKvYi4 rSi+o+t1CyVBxdU7oxu7Xm29Z93da+qjE19YV0pOKhlMCuId81X2vvKkMwtUV9moJcjg oLtyNDB/i6Qb7X10TMkmsePgDXgR63PM1pC19OEU7Eif/3JGfqAqqtqsxLHjFviOPl0B c4cQEc0qFPANCTXwEZH95AMBtxww2za97ECLVq8/V3aWcKaazk43BzsCPVSuc3OWvMG0 gKzCB6pB9/IgaYsQVQmWihPOHu5u0872dzBFhayxWXDjwQ4pMRY+0iZvuO+2Qmg2yXzg zs+Q== 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=PZD9rNqXHpyLqQ9/SyAFyoxq5uk/uHW0TGcsAg0pITo=; b=vaBed4XzIbqLYexU0KgijS2D9eO1/yJW1cBNs4BIeQe5ko6WovjT9FQSfcw/LkixdO hn8Kc4pK/wGLlpqOuL78oZAktCfh0MDlDFqy8c89MVfKs6YlkHNnw9F/YmEKhlHKHlkM hjohlYCzloWu2CE82Hty+iGCVGhpUgL/s6Q2EthQPfx4AcPoZKL2tLJb1HGjSqBW8UPc wS5qxR0b8uySrbol86PWLMNa3ggxq3i/4QokZNVSQdzhZP6Sixz6OunDVJskXooi7EZO 8zaY1bqF80idy36A/GnqXvG7AB3qWlVq0AoEmyz7vitsPgMsQR6Xtu4euS8V83cEod5U X+iQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=UJCkoy7Z; 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 p12si3866167pgj.56.2018.12.07.14.27.59; Fri, 07 Dec 2018 14:28:15 -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; dkim=pass header.i=@google.com header.s=20161025 header.b=UJCkoy7Z; 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 S1726093AbeLGW1Z (ORCPT + 99 others); Fri, 7 Dec 2018 17:27:25 -0500 Received: from mail-pl1-f193.google.com ([209.85.214.193]:35209 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726041AbeLGW1Y (ORCPT ); Fri, 7 Dec 2018 17:27:24 -0500 Received: by mail-pl1-f193.google.com with SMTP id p8so2446959plo.2 for ; Fri, 07 Dec 2018 14:27:24 -0800 (PST) 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=PZD9rNqXHpyLqQ9/SyAFyoxq5uk/uHW0TGcsAg0pITo=; b=UJCkoy7Z9/3o3PGUFf/Nm1nrOZc/+G5dsLbgJJvkpija3l1otpPcrs0d8cXUmJvm8A ckkQEd5qPQZcGnyyipmTF3CFB8fFoFv3IifjnqAo/rPetFovhMkTBWsXnm1bSlgUJN7A VvJDwIf4Xgs+HEiPUByb1llI8f9azHfBM0XIEA/4oVd43zYijuJ17hLjTpBtuoWU7y9g XwIpUIK8wTtdj43NdDBIPb6FcUMjH+FqbJSjUcH7W4D+208+wuv+qsSFIRypLhkVzvVM xNaVswlwPyRAE03GSgWp0TUj4Tu6/DNKuJBV3k7+3vxsnt6NpxPZtDlfM78YpBK8xtbQ WTCQ== 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=PZD9rNqXHpyLqQ9/SyAFyoxq5uk/uHW0TGcsAg0pITo=; b=Lf5CqyON3LCXG+x0n5SLLDq77BjLb8Tu94+ie+c+gmWf4yAytqhH+em3+mEz7gCYvu FXVSjOWgOVORWH2VMbHNd1TTXVD/Uwyu3v+nLcpGfovpytmUktPRRo115rrVRY1Y1zqP avWdw2JkPz4CQjmz5BziLjSCmoJA9tUUXPT1/Uo84Xf1Fd3qb1aCzsAIgvfaYLedonWC V7mQ53ZLAuA8pUJep1Jlbptcg+Q4SSNl/sSrvvumgTh4GN4IFfhivaO/9LzNp6pp9ag3 cQmtt+NbJsEe8TvTma43QXoK4KNPKWrhd6hBw0QCeod1N3wtKBA/9kTrGaRA/VLO+GpN zijw== X-Gm-Message-State: AA+aEWYrMri4DqvZxh4lNuGw1pbnRzS5f9lnrALU4jdi6qc3iOE5AyR/ eh6qVxVkLFaWFBFx01UEQgkLdA== X-Received: by 2002:a17:902:6502:: with SMTP id b2mr3762490plk.44.1544221643942; Fri, 07 Dec 2018 14:27:23 -0800 (PST) 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 x2sm5509976pfx.78.2018.12.07.14.27.22 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 07 Dec 2018 14:27:23 -0800 (PST) Date: Fri, 7 Dec 2018 14:27:22 -0800 (PST) From: David Rientjes X-X-Sender: rientjes@chino.kir.corp.google.com To: Vlastimil Babka cc: Linus Torvalds , Andrea Arcangeli , mgorman@techsingularity.net, mhocko@kernel.org, ying.huang@intel.com, s.priebe@profihost.ag, Linux List Kernel Mailing , alex.williamson@redhat.com, lkp@01.org, kirill@shutemov.name, Andrew Morton , zi.yan@cs.rutgers.edu Subject: Re: [patch for-4.20] Revert "mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask" In-Reply-To: <296d9813-1dfe-f27c-8d2c-6f140d8a5b0d@suse.cz> Message-ID: References: <296d9813-1dfe-f27c-8d2c-6f140d8a5b0d@suse.cz> 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 Fri, 7 Dec 2018, Vlastimil Babka wrote: > > This reverts commit 89c83fb539f95491be80cdd5158e6f0ce329e317. > > > > There are a couple of issues with 89c83fb539f9 independent of its partial > > revert in 2f0799a0ffc0 ("mm, thp: restore node-local hugepage > > allocations"): > > > > Firstly, the interaction between alloc_hugepage_direct_gfpmask() and > > alloc_pages_vma() is racy wrt __GFP_THISNODE and MPOL_BIND. > > alloc_hugepage_direct_gfpmask() makes sure not to set __GFP_THISNODE for > > an MPOL_BIND policy but the policy used in alloc_pages_vma() may not be > > the same for shared vma policies, triggering the WARN_ON_ONCE() in > > policy_node(). > > AFAICS 2f0799a0ffc0 removed the policy check in > alloc_hugepage_direct_gfpmask() comlpetely, so it's not racy and the > warning will always trigger for a MPOL_BIND policy right now? > Yup, looks like you hit it on the head. This revert should have been done alongside 2f0799a0ffc0 ("mm, thp: restore node-local hugepage allocations"), I didn't appreciate how invasive the consolidation patch was. I noticed the race in 89c83fb539f9 ("mm, thp: consolidate THP gfp handling into alloc_hugepage_direct_gfpmask") that is fixed by the revert, but as you noted it didn't cleanup the second part which is the balancing act for gfp flags between alloc_hugepage_direct_gfpmask() and alloc_pages_vma(). Syzbot found this to trigger the WARN_ON_ONCE() you mention. So we certainly need this patch for 4.20 as a follow-up to 2f0799a0ffc0. It's likely better to regroup and discuss NUMA aspects of all thp allocations separately with a stable 4.20.