Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6281254ybv; Tue, 18 Feb 2020 13:38:43 -0800 (PST) X-Google-Smtp-Source: APXvYqw2gft1NhaJE/twMJ3RJcGtGXJ0x6GsHX7YVilqTqUk4isLwgLxEhTmtYKL1hyj8DdxK4m0 X-Received: by 2002:a9d:7304:: with SMTP id e4mr15942674otk.99.1582061923806; Tue, 18 Feb 2020 13:38:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582061923; cv=none; d=google.com; s=arc-20160816; b=ccEPCy7dqI+I6Fq9rp6H7wAogtDqDdmhVgUNGOunIULX+oDN7CzBEz4J5U01QQSQlG IlFPbeVpIPl8X6e/PG78vca0AJFjvtoaMFYaRpNRRuKTafMVlKJngKlV6RGSgN0992Wh 8AzClg00jUnyqLq6l8UB5FyC/bSMdYE4EQqn/et+VBEeGDlOKyaw/qUk/h4nwGDeOIaY jRewyl9tbqdWUGI6SZ9lFvef06jajjRXef9iW/haEcNdL6Ei1nQXLaXjHaIMHpe2YxH1 iMPQc5cxK2NhHXlj8rnTHgahPO8IX8e0ZEuLPQJ/KNz4OmnE/LKVgEHTNqzxxbeO9wIw 1t2A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=FoArTrJylMnWlkqCFi8ZRwkMiw0N4sNay65yTiKUcw8=; b=DyOYWLjO2lqfKA69dc78wfgFkQmcZLU3LmPaAH7017oYl9QgP8viNp2zHQJ61YOS9L ARR0wL7UZmaNjlmqpPVjY6qx9ALWb6CEMOsrciyksMB0nfKbHkKbfmOuklUV1jCHpAU3 c+JLbflU+WsbRpzkkJvINwT2OTs5x+EIzruah4g1xYgAj+Rxlj8Qrbombmq+qz67Qt7Y kbdKU/Pl44zDas8+WhXRnLAyIAQ9Qoy/Nv9AtSB/UnD+LMA5/bSbZ8e4ZRU5mTRWbr++ DgPr/tgYq8/leiidB+Tog84M4Rlz+CYqyLDflRz9vQBbqC2EUKCj6HNyNwq/kGUu7KFB r9uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=CmAOW91X; 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 v25si14214otq.93.2020.02.18.13.38.32; Tue, 18 Feb 2020 13:38:43 -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=CmAOW91X; 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 S1727421AbgBRVgt (ORCPT + 99 others); Tue, 18 Feb 2020 16:36:49 -0500 Received: from mail-ot1-f66.google.com ([209.85.210.66]:40467 "EHLO mail-ot1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726595AbgBRVgt (ORCPT ); Tue, 18 Feb 2020 16:36:49 -0500 Received: by mail-ot1-f66.google.com with SMTP id i6so21052325otr.7 for ; Tue, 18 Feb 2020 13:36:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=FoArTrJylMnWlkqCFi8ZRwkMiw0N4sNay65yTiKUcw8=; b=CmAOW91XtqP4UUdWMtfykPWQ26luE5zu7mFfOZxd4Ds6vR66zhEAMV5frCjn5UgU0v JpPDq3+wp0VVZ03uRe+iI+f1VNP0koZHN1egietzjXTsXUX0/NS/5jantDolGjfRdW0E uYLefhkR0kQSKAd2/ACPTYX9SyswNyoRCJpQvp7/qHRKkAy2O6BBEkFZXguoT98teQEI L+ipnJfLXgOk/TRGLea0g+BM6gCwKRQf9EB5FH6mQ/B+o2jkRlwWY5xjWlr2cTNP2HNl 2xBoqTmAzlSF2o0p/nJHoJMVT/OE7CwXczBCr9JZ4KjqQ2OJqWoFMMjBGFx+HyiY8oGN xhhA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=FoArTrJylMnWlkqCFi8ZRwkMiw0N4sNay65yTiKUcw8=; b=gPE80+MZgxEios8BJj0R2BODn3RUNmqWBrchxY3P5DUUDOX2CJj7Wn88Z1HoxrF8N3 k3B2XxV1b6RvyGMps014vb0vaoq/B71lls2Fj0ZUr3fIes1aJMReivHsRS33dX6LRl8y 8UKxFtNSdZh5wBxnf3R1Z7kKAUpvbBAp2lv601v5HugNvNzJIC59BPGk5gmRiBPNOWK0 qinowaSPvTFmr13J8R9dInA21rv0Sd7EZAHxw89YgzT4ECtV/6KPJNsg1XZDfv0m1rYo 4VeSLCjNkZ1zSXHPDL7zpHwcflvrhDQ+a13aHblxcbljr093vFCr90bKTDWZG/N842RH ZbpQ== X-Gm-Message-State: APjAAAXic/tqjXwO31mHJwrwhVdKiT99uixq+rBt1v0LfXC4mhskAB4T yNqvwg9BZcGl7h+yWobXkW01x7nUo/pVpRDfZjH0iw== X-Received: by 2002:a9d:518b:: with SMTP id y11mr16379822otg.349.1582061808428; Tue, 18 Feb 2020 13:36:48 -0800 (PST) MIME-Version: 1.0 References: <20200211213128.73302-1-almasrymina@google.com> <20200211151906.637d1703e4756066583b89da@linux-foundation.org> <1582035660.7365.90.camel@lca.pw> In-Reply-To: From: Mina Almasry Date: Tue, 18 Feb 2020 13:36:37 -0800 Message-ID: Subject: Re: [PATCH v12 1/9] hugetlb_cgroup: Add hugetlb_cgroup reservation counter To: Mike Kravetz Cc: Qian Cai , Andrew Morton , shuah , David Rientjes , Shakeel Butt , Greg Thelen , open list , linux-mm@kvack.org, linux-kselftest@vger.kernel.org, cgroups@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 18, 2020 at 11:25 AM Mina Almasry wrote: > > On Tue, Feb 18, 2020 at 11:14 AM Mike Kravetz wrote: > > > > On 2/18/20 10:35 AM, Mina Almasry wrote: > > > On Tue, Feb 18, 2020 at 6:21 AM Qian Cai wrote: > > >> > > >> On Tue, 2020-02-11 at 15:19 -0800, Andrew Morton wrote: > > >>> On Tue, 11 Feb 2020 13:31:20 -0800 Mina Almasry wrote: > > >>> > > >> [ 7933.806377][T14355] ------------[ cut here ]------------ > > >> [ 7933.806541][T14355] kernel BUG at mm/hugetlb.c:490! > > >> VM_BUG_ON(t - f <= 1); > > >> [ 7933.806562][T14355] Oops: Exception in kernel mode, sig: 5 [#1] > > > > > Hi Qian, > > > > > > Yes this VM_BUG_ON was added by a patch in the series ("hugetlb: > > > disable region_add file_region coalescing") so it's definitely related > > > to the series. I'm taking a look at why this VM_BUG_ON fires. Can you > > > confirm you reproduce this by running hugemmap06 from the ltp on a > > > powerpc machine? Can I maybe have your config? > > > > > > Thanks! > > > > Hi Mina, > > > > Looking at the region_chg code again, we do a > > > > resv->adds_in_progress += *out_regions_needed; > > > > and then potentially drop the lock to allocate the needed entries. Could > > anopther thread (only adding reservation for a single page) then come in > > and notice that there are not enough entries in the cache and hit the > > VM_BUG_ON()? > > Maybe. Also I'm thinking the code thinks actual_regions_needed >= > in_regions_needed, but that doesn't seem like a guarantee. I think > this call sequence with the same t->f range would violate that: > > region_chg (regions_needed=1) > region_chg (regions_needed=1) > region_add (fills in the range) > region_add (in_regions_needed = 1, actual_regions_needed = 0, so > assumptions in the code break). > > Luckily it seems the ltp readily reproduces this, so I'm working on > reproducing it. I should have a fix soon, at least if I can reproduce > it as well. I had a bit of trouble reproducing this but I got it just now. Makes sense I've never run into this even though others can readily reproduce it. I happen to run my kernels on a pretty beefy 36 core machine and in that setup things seem to execute fast and there is never a queue of pending file_region inserts into the resv_map. Once I limited qemu to only use 2 cores I ran into the issue right away. Looking into a fix now.