Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp6178657ybv; Tue, 18 Feb 2020 11:26:50 -0800 (PST) X-Google-Smtp-Source: APXvYqy+IUXNLZw5laTP32o8JCfp6hymXEUTUE54E2oW2yq14VDZ3pQQyIU2k1FaR/doJRxJEgf8 X-Received: by 2002:aca:4c11:: with SMTP id z17mr2168742oia.104.1582054010068; Tue, 18 Feb 2020 11:26:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582054010; cv=none; d=google.com; s=arc-20160816; b=jVgZ9o16VF3tqcmHZzDlRMbxum34WkJK9kXjl6q6OBFvRPY+4bfUnc5i4qIhWJYukG v8DCcmwvDybSXuCzD39avD83jU8DEfZsy0MeANB8Sh3LqXgXsj6StVHpqvAmsGwkokff SDe4M7Ors2R3yBAv5xRzcTMSRRlEuhpW4k0hCEmVUGRo70CIywVHmoAWuWXudu1ozlFx MVWsCxxAyJZN1DGyOlKcF/FOJQUc/KUCsGjIIgWgpmx9vUW+fsU7k7LiQtGLaPuTVKMq QDZHZ9x18Qr/CFeJqPNuuKTyN9dZdlOr4cc9pxv8yIfReXlYHCugt3NgHd2b1PxWh8gB 0j/g== 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=ckyuMsvFFux27LQS5gOMapLWD0YEn71aKg1bpT/CAjA=; b=Mp64TJsyi0IWAUbxhN77H9zC4arxk4W3O/qAfho9Gx/M48gr8iw6Ps9RPQAayAG24/ JgVb/CVpixxvwhd0EJLJFjyOd02Gv0iT/oHcRo4fPRAQMX5jtMj8BadUUcKbjGvDD3XT jlL7r9Vh2Ton637OkUCJkawY7/1Pl69iiTWoNxZGdpIhc0b8r8WDHgnbf1xXBN3NWKgG ktcvwAR1QCbNXzErCjywm7diykHwO5Oixg4BFe8V70Jk/tQO9nw7aXmKAz8AeWtr5Pfr WikTgrsT9a+s6abfqBPZ+dDbnlyAoo3a7DyOuEeddew8t9xawbbbuEKfNC+O2V2wBGwd wlSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=LInPmrzn; 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 m5si2206033ote.187.2020.02.18.11.26.36; Tue, 18 Feb 2020 11:26:50 -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=LInPmrzn; 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 S1726422AbgBRTZ1 (ORCPT + 99 others); Tue, 18 Feb 2020 14:25:27 -0500 Received: from mail-ot1-f65.google.com ([209.85.210.65]:37404 "EHLO mail-ot1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726291AbgBRTZ0 (ORCPT ); Tue, 18 Feb 2020 14:25:26 -0500 Received: by mail-ot1-f65.google.com with SMTP id w23so4241958otj.4 for ; Tue, 18 Feb 2020 11:25:26 -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=ckyuMsvFFux27LQS5gOMapLWD0YEn71aKg1bpT/CAjA=; b=LInPmrzntLI+jey3b9w6N4OrF2TdfG25R+K2QF/mwg6GTKX2jDpNjmqDrf8XptazpF 0eJnz6Q1Nly0gjKtPY5OS3iUmwv2lWV1k8wAwe2ozY+oI5mVBxRPMXXZihTZQor5kX0u 3Z77DqUqb83Gcv5APxzKjWL+9YImg9aDivBa0Yw8wOsd48e1PeNJhVnQoYPq+5fWyPQ7 UY64+pNkMncc7yibup3yOtrxNd1WCEAXPZPTFTY3lPqdM23ARdrIdLB7gIW137/Ml04T QIo328ZrSU7GsXA8u/PQQuXj4f+n8xkH3xf7jSC/xzzDjs/3KufJnszHAFlIni42hjyI z/8g== 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=ckyuMsvFFux27LQS5gOMapLWD0YEn71aKg1bpT/CAjA=; b=i5EHw8L5UeKR5HprQeXrSkkN2p7nfwA4+vVSpfHcEMufKFqCirj5n9G92Dinue51QX U5tVwcdv5KdaZ3SDLRIZNCCBvCXvvLSKxuETsn0IY9gzPc71TkLLRpDYfv+ywPQc5D8S vpEehjXP7sMcdQPLlq/soTIN95nKvqM2uLdjnCvT6Ce/CagT/XAjfvQsUSTfKNeSX4Um uVuhrjmgOe09UQkk2wYh03DjRQJqc0yKKJ+U4zqtLGsZwDQbcnIXk31tfpy3cporD5QF FCLcXIf4Z8PST2YSWye92Z36hTqtg7qw/qnVZZ3mNh5JNLVe4ok5DUj9LGSSeSZ0S0yG 8Jeg== X-Gm-Message-State: APjAAAUVlCAhZm3EQ5rQq885j6AmYS8lfLJrESw/syts2SK63zRnhno5 ifwL3pyeogqp0QaAChBJPM3YAQG2LKAeZP6FZQiphQ== X-Received: by 2002:a9d:6a2:: with SMTP id 31mr16569798otx.313.1582053925869; Tue, 18 Feb 2020 11:25:25 -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 11:25:14 -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: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.